Permalink
Browse files

Tax API extended to include max values too. Tax API documentation added

  • Loading branch information...
1 parent b7695bf commit 64445a5fe8d55c555d7cf5b276fb5beb4949b26b einhverfr committed May 1, 2012
View
@@ -14,6 +14,7 @@ Changelog for 1.3.16
* Fixed errors about Concat() not found on Pg 8.4 (Erik H)
* Fixed can't edit templates with absolute templates path (Chris T 3516725)
* Added API for minimum value for taxes for local tax modules (Chris T)
+* Added API (but not UI) for tax max value (Chris T)
John L is John Locke
Michael R is Michael Richardson
View
@@ -1947,10 +1947,11 @@ sub save_taxes {
$validto = 'infinity' if not $validto;
$form->{"pass_$i"} = 0 if not $form->{"pass_$i"};
delete $form->{"old_validto_$i"} if ! $form->{"old_validto_$i"};
-
- $sth = $dbh->prepare('select account__save_tax(?,?,?,?,?,?,?,?)');
+
+ $sth = $dbh->prepare('select account__save_tax(?,?,?,?,?,?,?,?,?)');
my @queryargs = (
- $chart_id, $validto, $rate, $form->{"minvalue_$i"},
+ $chart_id, $validto, $rate,
+ $form->{"minvalue_$i"}, $form->{"maxvalue_$i"},
$form->{"taxnumber_$i"}, $form->{"pass_$i"},
$form->{"taxmodule_id_$i"}, $form->{"old_validto_$i"}
);
@@ -37,6 +37,7 @@ struct Taxes::Simple => {
account => '$',
value => 'Math::BigFloat',
minvalue => 'Math::BigFloat', #Ignored in Simple Tax rules
+ maxvalue => 'Math::BigFloat', #Ignored in Simple Tax rules
pass => '$'
};
View
Binary file not shown.
@@ -1070,6 +1070,10 @@ \subsection{Taxes, Defaults, and Preferences}
integer which allows one to specify a tax run which occurs on the form after
any rules with lower entries in this box. This allows for compounding of sales tax (for example, when PST applies to the total and GST as well).
+As in 1.3.16, new API's have been added to allow one to pass info to tax modules
+as to minimum and maximum taxable values. These values are not currently used
+by the simple tax module, but this behavior may change in the future.
+
\subsubsection{Adding A Sales Tax Account}
Sales Tax is collected on behalf of a state or national government
View
@@ -1,7 +1,7 @@
RELEASE NOTES
LedgerSMB 1.3
-Latest Revision: 1.3.16, April 25, 2012.
+Latest Revision: 1.3.16, April 30, 2012.
1: Welcome to LedgerSMB
@@ -103,12 +103,21 @@ assigned separately on different databases.
2.6: Fixed Asset Handling
-LedgerSMB 1.3 comes with a fixed asset module, meaning you can now define your assets,
-depreciate them, and dispose of them either entirely or partially.
+LedgerSMB 1.3 comes with a fixed asset module, meaning you can now define your
+assets, depreciate them, and dispose of them either entirely or partially.
The fixed asset system is designed to be extensible. Currently only time-based,
-straight-line depreciations are included. However the system is designed to allow the
-creation of new depreciation methods including time-based and production-based methods.
+straight-line depreciations are included. However the system is designed to
+allow the creation of new depreciation methods including time-based and
+production-based methods.
+
+2.7: Tax Changes
+
+As of LedgerSMB 1.3.16, a few changes were made to the Sales Tax API so that it
+is easier to implement local tax rules. This includes a minimum tax value,
+exposed through the user interface, and a maximum value which is not yet
+exposed. The handling of these are module-specific and they are ignored by the
+Simple tax module included.
3: Known Issues
View
@@ -1461,6 +1461,7 @@ CREATE TABLE tax (
chart_id int REFERENCES account(id),
rate numeric,
minvalue numeric,
+ maxvalue numeric,
taxnumber text,
validto timestamp not null default 'infinity',
pass integer DEFAULT 0 NOT NULL,
View
@@ -260,14 +260,15 @@ in_pass int, in_taxmodule_id int, in_old_validto date);
CREATE OR REPLACE FUNCTION account__save_tax
(in_chart_id int, in_validto date, in_rate numeric, in_minvalue numeric,
-in_taxnumber text,
+in_maxvalue numeric, in_taxnumber text,
in_pass int, in_taxmodule_id int, in_old_validto date)
returns bool as
$$
BEGIN
UPDATE tax SET validto = in_validto,
rate = in_rate,
minvalue = in_minvalue,
+ maxvalue = in_maxvalue,
taxnumber = in_taxnumber,
pass = in_pass,
taxmodule_id = in_taxmodule_id
@@ -277,10 +278,10 @@ BEGIN
return true;
END IF;
- INSERT INTO tax(chart_id, validto, rate, minvalue, taxnumber, pass,
- taxmodule_id)
- VALUES (in_chart_id, in_validto, in_rate, in_minvalue, in_taxnumber,
- in_pass, in_taxmodule_id);
+ INSERT INTO tax(chart_id, validto, rate, minvalue, maxvalue, taxnumber,
+ pass, taxmodule_id)
+ VALUES (in_chart_id, in_validto, in_rate, in_minvalue, in_maxvalue,
+ in_taxnumber, in_pass, in_taxmodule_id);
RETURN TRUE;
View
@@ -267,5 +267,7 @@ BEGIN;
-- MIN VALUE FOR TAXES
ALTER TABLE tax ADD minvalue numeric;
+ALTER TABLE tax ADD maxvalue numeric;
+
COMMIT;

0 comments on commit 64445a5

Please sign in to comment.