details:   /erp/devel/pi/rev/4b75a6927f27
changeset: 12186:4b75a6927f27
user:      Ioritz Cia <ioritz.cia <at> openbravo.com>
date:      Tue May 17 10:00:18 2011 +0200
summary:   Fixes issue when calculating overdue due to rounding.

diffstat:

 
modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
 |  20 +++++-----
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (44 lines):

diff -r 694e5e58c1aa -r 4b75a6927f27 
modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
--- 
a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
        Tue May 17 09:51:48 2011 +0200
+++ 
b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
        Tue May 17 10:00:18 2011 +0200
@@ -405,6 +405,7 @@
       BigDecimal amountSum = BigDecimal.ZERO;
       FieldProvider previousRow = null;
       ConversionRate previousConvRate = null;
+      long milisecDayConv = (1000 * 60 * 60 * 24);
 
       for (int i = 0; i < data.length; i++) {
         if (FIN_PaymentScheduleDetail[i].getPaymentDetails() != null) {
@@ -511,23 +512,22 @@
               
FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getDueDate()).toString());
           // plannedDSO
           plannedDSO = 
(FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getDueDate()
-              .getTime() - invoicedDate.getTime());
-          FieldProviderFactory.setField(data[i], "PLANNED_DSO", 
String.valueOf(plannedDSO
-              / (1000 * 60 * 60 * 24)));
+              .getTime() - invoicedDate.getTime())
+              / milisecDayConv;
+          FieldProviderFactory.setField(data[i], "PLANNED_DSO", 
String.valueOf(plannedDSO));
           // currentDSO
           if (FIN_PaymentScheduleDetail[i].getPaymentDetails() != null) {
-            currentDSO = 
FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment()
-                .getPaymentDate().getTime()
-                - invoicedDate.getTime();
+            currentDSO = 
(FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment()
+                .getPaymentDate().getTime() - invoicedDate.getTime())
+                / milisecDayConv;
           } else {
             currentTime = System.currentTimeMillis();
-            currentDSO = currentTime - invoicedDate.getTime();
+            currentDSO = (currentTime - invoicedDate.getTime()) / 
milisecDayConv;
           }
-          FieldProviderFactory.setField(data[i], "CURRENT_DSO", 
String.valueOf((currentDSO)
-              / (1000 * 60 * 60 * 24)));
+          FieldProviderFactory.setField(data[i], "CURRENT_DSO", 
String.valueOf((currentDSO)));
           // daysOverdue
           FieldProviderFactory.setField(data[i], "OVERDUE", String
-              .valueOf((currentDSO - plannedDSO) / (1000 * 60 * 60 * 24)));
+              .valueOf((currentDSO - plannedDSO)));
         } else {
           // project
           FieldProviderFactory.setField(data[i], "PROJECT", "");

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to