@Petros: In file taxes/tax_calc.inc the functions get_tax_free_price_for_item() and get_tax_for_items() use the formula for calculation you stated.
Please see if these are the places you would like to change.
Rounding is done for consistent storage value in the db to persist across version changes of the db server.
Other places where such code is available are listed below.
In file purchasing/includes/db/supp_payment_db.inc lines 114 to 116 when $rate <> 0:
$supp_amount = round($amount / $rate, user_price_dec());
$supp_discount = round($discount / $rate, user_price_dec());
$supp_charge = round($charge / $rate, user_price_dec());
In file purchasing/includes/db/invoice_db.inc lines 129 to 133:
foreach ($taxes as $n => $taxitem)
{
$taxes[$n]['Value'] = round2($taxitem['Value'], user_price_dec());
$tax_total += $taxes[$n]['Value'];
}
and lines 137 to 143:
$item_added_tax = 0;
if (!$supp_trans->tax_included)
{
$taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
foreach ($taxes as $n => $taxitem)
$item_added_tax += isset($taxitem['Override']) ? $taxitem['Override'] : round2($taxitem['Value'], user_price_dec());
}
In file purchasing/includes/supp_trans_class.inc lines 112 to 117:
foreach ($this->grn_items as $ln_itm)
{
$items[] = $ln_itm->item_code;
$prices[] =round( ($ln_itm->this_quantity_inv * $ln_itm->chg_price),
user_price_dec());
}
lines 160 to 162:
foreach ($this->grn_items as $ln_itm)
$total += round(($ln_itm->this_quantity_inv * $ln_itm->taxfree_charge_price($tax_group_id, $tax_group)),
user_price_dec());
lines 176 to 177:
foreach ($this->grn_items as $ln_itm)
$total += round($ln_itm->this_quantity_inv * $ln_itm->chg_price, user_price_dec());
In file purchasing/includes/po_class.inc lines 141 to 144:
foreach ($this->line_items as $ln_itm) {
$items[] = $ln_itm->stock_id;
$prices[] = round($ln_itm->price * ($receival ? $ln_itm->receive_qty : $ln_itm->quantity), user_price_dec());
}
lines 164 to 184:
function get_trans_total() {
$total = 0;
$dec = user_price_dec();
foreach ($this->line_items as $ln_itm) {
$items[] = $ln_itm->stock_id;
$value = round($ln_itm->quantity * $ln_itm->price, $dec);
$prices[] =$value;
$total += $value;
}
if (!$this->tax_included ) {
$taxes = get_tax_for_items($items, $prices, 0, $this->tax_group_id,
$this->tax_included, $this->tax_group_array);
foreach($taxes as $tax)
$total += round($tax['Value'], $dec);
}
return $total;
}
In file purchasing/po_entry_items.php lines 465 to 470:
foreach($cart->line_items as $key => $line) {
$inv->add_grn_to_trans($line->grn_item_id, $line->po_detail_rec, $line->stock_id,
$line->item_description, $line->receive_qty, 0, $line->receive_qty,
$line->price, $line->price, true, get_standard_cost($line->stock_id), '');
$inv->ov_amount += round2(($line->receive_qty * $line->price), user_price_dec());
}