Topic: What does Tax Algorithm do?

Hi, I've searched for in the wiki and here in the forum and cannot find anything about Tax Algorithm in Setup -> System and General GL Setup there's two options: Taxes from totals & Sum per line taxes?

I'm guessing it has something to do with rounding?

Any help appreciated.

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: What does Tax Algorithm do?

tax_algorithm is stored as a 1 (Taxes from Totals) / 2 (Sum per line taxes) value in sys_prefs table (ie., on a per company basis) with the former as the default.

The file includes/sysnames.inc lists the possible values as:

$tax_algorithms = array( 
    TCA_LINES => _("Sum per line taxes"), 
    TCA_TOTALS => _("Taxes from totals")
);

The function tax_algorithm_list() in the file includes/ui/ui_lists.inc gets the select box suitable populated with the above.

The file admin/gl_setup.php is currently the only file that calls the above function and provides the form and  its processing code for the said field.

The Wiki page still shows the screeenshot and writeup for FA 2.3 where it was not available then. Stands updated.

Study the code in the function get_tax_for_items() in the file taxes/tax_calc.inc. The function round2() is used as the rounding function and is defined in includes/current_user.inc:

function round2($number, $decimals=0)
{
    $delta = ($number < 0 ? -.0000000001 : .0000000001);
    return round($number+$delta, $decimals);
}

In each case of it's use, the $decimals parameter was taken from the user choices using $dec = user_price_dec();.

Re: What does Tax Algorithm do?

Thanks apmuthu thats a lot clearer now

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/