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

Re: Changing tax.pm in 1.21 for a new tax which replaces two old taxes



On Tue, Jul 6, 2010 at 10:33 PM, Chris Travers <..hidden..> wrote:
> Here is what I'm going to propose we do:
>
> alter Tax.pm to retrieve no taxes from any modules which have a 0
> rate.  This would allow any tax to be set to 0 and thus be skipped.
> Complex taxes would need to be set to a real rate other than 0.
>
> Try this patch:
>
> Index: LedgerSMB/Tax.pm
> ===================================================================
> --- LedgerSMB/Tax.pm    (revision 2960)
> +++ LedgerSMB/Tax.pm    (working copy)
> @@ -62,6 +62,7 @@
>         $sth->execute($taxaccount, $transdate)
>                || $form->dberror($query);
>         my $ref = $sth->fetchrow_hashref;
> +        next if !$ref->{rate};
>
>         my $module = $ref->{'taxmodulename'};
>         require "LedgerSMB/Taxes/${module}.pm";
>
> ------------------------------------------------------------------------------


This will print an invoice/order/purchase order/sales order dated
prior to the tax change, but without any tax applied. No tax lines are
visible. This is the tax table:

 select * from tax;
 chart_id | rate | taxnumber |  validto   | pass | taxmodule_id
----------+------+-----------+------------+------+--------------
    10131 | 0.05 |           | 2010-06-30 |    0 |            1
    10127 | 0.05 |           | 2010-06-30 |    0 |            1
   120149 |    0 |           | 2010-06-30 |    0 |            1
   120149 | 0.12 |           |            |    0 |            1
   120147 |    0 |           | 2010-06-30 |    0 |            1
   120147 | 0.12 |           |            |    0 |            1
    10125 | 0.07 |           | 2010-06-30 |    0 |            1
(7 rows)


Gerald.