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

SF.net SVN: ledger-smb:[4697] branches/1.3



Revision: 4697
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4697&view=rev
Author:   einhverfr
Date:     2012-05-07 02:16:46 +0000 (Mon, 07 May 2012)
Log Message:
-----------
Adding min/max value handling to Simple tax module

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/Taxes/Simple.pm

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-05-06 08:19:48 UTC (rev 4696)
+++ branches/1.3/Changelog	2012-05-07 02:16:46 UTC (rev 4697)
@@ -2,6 +2,10 @@
 Initial Release:  Monday, Oct 12 2011
 Supported Presently
 
+Changelog for 1.3.17
+* Address now shows on ECA selection screen (Erik H)
+* Taxes::Simple now respects min/max values based on subtotal (Chris T)
+
 Changelog for 1.3.16
 
 * Changes in <head> element for non-Latin characters, HTML invoices (Erik H)

Modified: branches/1.3/LedgerSMB/Taxes/Simple.pm
===================================================================
--- branches/1.3/LedgerSMB/Taxes/Simple.pm	2012-05-06 08:19:48 UTC (rev 4696)
+++ branches/1.3/LedgerSMB/Taxes/Simple.pm	2012-05-07 02:16:46 UTC (rev 4697)
@@ -44,6 +44,12 @@
 sub calculate_tax {
     my ( $self, $form, $subtotal, $extract, $passrate ) = @_;
     my $rate = $self->rate;
+    if ($form->{subtotal} && (abs($form->{subtotal}) < $self->minvalue 
+                            || ($self->maxvalue && 
+                               abs($form->{subtotal}) > $self->maxvalue))
+    ){
+         return 0;
+    }
     my $tax = $subtotal * $rate / ( Math::BigFloat->bone() + $passrate );
     $tax = $subtotal * $rate if not $extract;
     return $tax;

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