[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4249] branches/1.3/LedgerSMB/AA.pm



Revision: 4249
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4249&view=rev
Author:   ehuelsmann
Date:     2011-12-31 11:10:54 +0000 (Sat, 31 Dec 2011)
Log Message:
-----------
Fix mismatch in foreign currency AR/AP transaction creation and payment.

Modified Paths:
--------------
    branches/1.3/LedgerSMB/AA.pm

Modified: branches/1.3/LedgerSMB/AA.pm
===================================================================
--- branches/1.3/LedgerSMB/AA.pm	2011-12-29 12:32:16 UTC (rev 4248)
+++ branches/1.3/LedgerSMB/AA.pm	2011-12-31 11:10:54 UTC (rev 4249)
@@ -188,7 +188,12 @@
 
             # multiply by exchangerate
             $amount = $amount{fxamount}{$i} * $form->{exchangerate};
-            $amount{amount}{$i} = $form->round_amount( $amount - $diff, 2 );
+
+	    # The following line used to be
+	    # $amount{amount}{$i} =  $form->round_amount( $amount - $diff, 2 );
+	    # but that causes problems when processing the payments
+	    # due to the fact that the payments are un-rounded
+            $amount{amount}{$i} = $amount;
             $diff = $amount{amount}{$i} - ( $amount - $diff );
 
             ( $null, $project_id ) = split /--/, $form->{"projectnumber_$i"};
@@ -267,9 +272,12 @@
     }
 
     $fxinvamount += $fxtax unless $form->{taxincluded};
-    $fxinvamount = $form->round_amount( $fxinvamount, 2 );
-    $invamount   = $form->round_amount( $invamount,   2 );
-    $paid        = $form->round_amount( $paid,        2 );
+#   These lines are commented out because payments get posted without
+#   rounding. Having rounded amounts on the AR/AP creation side leads
+#   to unmatched payments
+#    $fxinvamount = $form->round_amount( $fxinvamount, 2 );
+#    $invamount   = $form->round_amount( $invamount,   2 );
+#    $paid        = $form->round_amount( $paid,        2 );
 
     $paid =
       ( $fxinvamount == $paid )

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.