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

SF.net SVN: ledger-smb:[5102] trunk



Revision: 5102
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5102&view=rev
Author:   einhverfr
Date:     2012-08-05 10:55:06 +0000 (Sun, 05 Aug 2012)
Log Message:
-----------
Moving AR/AP transactions to one foreign exchange rate per transaction

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/bin/aa.pl

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2012-08-05 09:46:27 UTC (rev 5101)
+++ trunk/LedgerSMB/AA.pm	2012-08-05 10:55:06 UTC (rev 5102)
@@ -526,10 +526,17 @@
 			                  WHERE accno = ?), 
 			                  ?, ?)|;
         @queryargs =
-          ( $form->{id}, $accno, $invamount * -1 * $ml, $form->{transdate} );
+          ( $form->{id}, $accno, $invamount * -1 * $ml / $form->{exchangerate}, 
+            $form->{transdate} );
 
         $dbh->prepare($query)->execute(@queryargs)
           || $form->dberror($query);
+        if ($form->{exchangerate} != 1){
+           $dbh->prepare($query)->execute($form->{id}, $accno,
+                  ($invamount * -1 * $ml) - 
+                  ($invamount * -1 * $ml / $form->{exchangerate}),
+                  $form->{transdate} );
+        }
     }
 
     # if there is no amount force ar/ap

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2012-08-05 09:46:27 UTC (rev 5101)
+++ trunk/bin/aa.pl	2012-08-05 10:55:06 UTC (rev 5102)
@@ -497,21 +497,12 @@
     if (   $form->{defaultcurrency}
         && $form->{currency} ne $form->{defaultcurrency} )
     {
-        if ( $form->{forex} ) {
             $exchangerate .= qq|
-	<th align=right>| . $locale->text('Exchange Rate') . qq|</th>
-	<td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
-|;
-        }
-        else {
-            $exchangerate .= qq|
         <th align=right>| . $locale->text('Exchange Rate') . qq|</th>
         <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
 |;
-        }
     }
     $exchangerate .= qq|
-<input type=hidden name=forex value=$form->{forex}>
 </tr>
 |;
 

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