function to_home_currency($amount, $currency_code, $date_)
{
$ex_rate = get_exchange_rate_to_home_currency($currency_code, $date_);
- return $amount / $ex_rate;
+ return round($amount / $ex_rate, user_price_dec());
}
//----------------------------------------------------------------------------------
foreach ($this->grn_items as $ln_itm)
{
$items[] = $ln_itm->item_code;
- $prices[] = ($ln_itm->this_quantity_inv * $ln_itm->taxfree_charge_price($tax_group_id, $tax_group));
+ $prices[] =round( ($ln_itm->this_quantity_inv * $ln_itm->taxfree_charge_price($tax_group_id, $tax_group)),
+ user_price_dec());
}
if ($tax_group_id == null)
$tax_group = null;
foreach ($this->grn_items as $ln_itm)
- $total += ($ln_itm->this_quantity_inv * $ln_itm->taxfree_charge_price($tax_group_id, $tax_group));
+ $total += round(($ln_itm->this_quantity_inv * $ln_itm->taxfree_charge_price($tax_group_id, $tax_group)),
+ user_price_dec());
foreach ($this->gl_codes as $gl_line)
$total += $gl_line->amount;
if ($po_line->Deleted == false)
{
- $line_total = $po_line->quantity * $po_line->price;
+ $line_total = round($po_line->quantity * $po_line->price, user_price_dec());
if (!$editable || !isset($_GET['Edit']) || $_GET['Edit'] != $po_line->line_no)
{
alt_table_row_color($k);
amount_cells(null, 'price', null);
//$line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100);
- $line_total = input_num('qty') * input_num('price');
+ $line_total = round(input_num('qty') * input_num('price'), user_price_dec());
amount_cell($line_total);
if (isset($_GET['Edit']))
include_once($path_to_root . "/includes/session.inc");
-//include($path_to_root . "/includes/data_checks.inc");
-//include($path_to_root . "/includes/manufacturing.inc");
-
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = get_js_form_entry("StockID2", "stock_id", "qty");
qty_cell($myrow["quantity_inv"]);
qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
amount_cell($myrow["unit_price"]);
- amount_cell($myrow["unit_price"] * $myrow["quantity_inv"]);
+ amount_cell(round($myrow["unit_price"] * $myrow["quantity_inv"], user_price_dec()));
end_row();
$i++;
if ($i > 15)
qty_cell($myrow["quantity_inv"]);
qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
amount_cell($myrow["unit_price"]);
- amount_cell($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]));
+ amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]),
+ user_price_dec()));
end_row();
$i++;
$from = 0;
if ($to == null)
$to = 0;
- $dec =user_price_dec();
+ $dec = user_price_dec();
$fno = explode("-", $from);
$tno = explode("-", $to);
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = $sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]);
+ $Net = round($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
$DisplayQty = number_format2($sign*$myrow2["quantity"],user_qty_dec());
$from = 0;
if ($to == null)
$to = 0;
- $dec =user_price_dec();
+ $dec = user_price_dec();
$cols = array(4, 60, 225, 300, 325, 385, 450, 515);
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]);
+ $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
$DisplayQty = number_format2($myrow2["quantity"],user_qty_dec());
$from = 0;
if ($to == null)
$to = 0;
- $dec =user_price_dec();
+ $dec = user_price_dec();
$fno = explode("-", $from);
$tno = explode("-", $to);
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]);
+ $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
$DisplayQty = number_format2($myrow2["quantity"],user_qty_dec());
$from = 0;
if ($to == null)
$to = 0;
- $dec =user_price_dec();
+ $dec = user_price_dec();
$cols = array(4, 60, 225, 300, 325, 385, 450, 515);
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = ($myrow2["unit_price"] * $myrow2["quantity_ordered"]);
+ $Net = round(($myrow2["unit_price"] * $myrow2["quantity_ordered"]),
+ user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
$DisplayQty = number_format2($myrow2["quantity_ordered"],user_qty_dec());
foreach ($this->line_items as $ln_itm) {
$price = $ln_itm->line_price();
- $total += ($ln_itm->quantity * $price * (1 - $ln_itm->discount_percent));
+ $total += round($ln_itm->quantity * $price * (1 - $ln_itm->discount_percent),
+ user_price_dec());
}
return $total;
}
foreach ($this->line_items as $ln_itm) {
$price = $ln_itm->line_price();
- $total += ($ln_itm->qty_dispatched * $price * (1 - $ln_itm->discount_percent));
+ $total += round(($ln_itm->qty_dispatched * $price * (1 - $ln_itm->discount_percent)),
+ user_price_dec());
}
return $total;
}
foreach ($this->line_items as $ln_itm) {
$items[] = $ln_itm->stock_id;
- $prices[] = ($ln_itm->qty_dispatched *
- $ln_itm->line_price()* (1 - $ln_itm->discount_percent));
+ $prices[] = round(($ln_itm->qty_dispatched *
+ $ln_itm->line_price()* (1 - $ln_itm->discount_percent)), user_price_dec());
}
$taxes = get_tax_for_items($items, $prices, $shipping_cost,
- $this->tax_group_id, $this->tax_included, $this->tax_group_array);
+ $this->tax_group_id, $this->tax_included, $this->tax_group_array);
return $taxes;
}
}
}
if($this->tax_included)
- return $this->freight_cost*$tax_rate/($tax_rate+100);
+ return round($this->freight_cost*$tax_rate/($tax_rate+100), user_price_dec());
else
- return $this->freight_cost*$tax_rate/100;
+ return round($this->freight_cost*$tax_rate/100, user_price_dec());
}
} /* end of class defintion */
foreach ($order->line_items as $line_no=>$line)
{
- $line_total = $line->qty_dispatched * $line->price * (1 - $line->discount_percent);
+ $line_total = round($line->qty_dispatched * $line->price * (1 - $line->discount_percent),
+ user_price_dec());
if (!isset($_GET['Edit']))
$id = -1;
else
foreach ($order->line_items as $line_no=>$stock_item)
{
- $line_total = $stock_item->qty_dispatched * $stock_item->price * (1 - $stock_item->discount_percent);
+ $line_total = round($stock_item->qty_dispatched * $stock_item->price * (1 - $stock_item->discount_percent),
+ user_price_dec());
if (!isset($_GET['Edit']))
$id = -1;
alt_table_row_color($k);
- $value = ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]);
+ $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
if($myrow2['quantity']==0) continue;
alt_table_row_color($k);
- $value = ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]);
+ $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
if($myrow2["quantity"]==0) continue;
alt_table_row_color($k);
- $value = ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]);
+ $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
}
else
{
- $display_discount = percent_format2($myrow2["discount_percent"]*100) . "%";
+ $display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
}
label_cell($myrow2["stock_id"]);
foreach ($_SESSION['Items']->line_items as $stock_item) {
- $line_total = $stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent);
+ $line_total = round($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent),
+ user_price_dec());
alt_table_row_color($k);
$tax_multiplier += $taxitem["rate"];
}
- return $price / (1 + ($tax_multiplier / 100));
+ return round($price / (1 + ($tax_multiplier / 100)), user_price_dec());
}
//
// Full price (incl. VAT) for item $stock_id with line price $price,
$tax_multiplier += $taxitem["rate"];
}
- return $price * (1 + ($tax_multiplier / 100));
+ return round($price * (1 + ($tax_multiplier / 100)), user_price_dec());
}
//---------------------------------------------------------------------------------
{
$index = $item_tax['tax_type_id'];
if($tax_included==1)
- $ret_tax_array[$index]['Value'] += $prices[$i] * $item_tax['rate']
- / ($item_tax['rate'] + 100);
+ $ret_tax_array[$index]['Value'] += round($prices[$i] * $item_tax['rate']
+ / ($item_tax['rate'] + 100), user_price_dec());
else
- $ret_tax_array[$index]['Value'] += $prices[$i] * $item_tax['rate'] / 100;
+ $ret_tax_array[$index]['Value'] +=
+ round($prices[$i] * $item_tax['rate'] / 100, user_price_dec());
}
}
}
$index = $item_tax['tax_type_id'];
if(isset($ret_tax_array[$index])) {
if($tax_included==1)
- $ret_tax_array[$index]['Value'] += $shipping_cost * $item_tax['rate']
- / ($item_tax['rate'] + 100);
+ $ret_tax_array[$index]['Value'] += round($shipping_cost * $item_tax['rate']
+ / ($item_tax['rate'] + 100), user_price_dec());
else
- $ret_tax_array[$index]['Value'] += $shipping_cost * $item_tax['rate'] / 100;
+ $ret_tax_array[$index]['Value'] +=
+ round($shipping_cost * $item_tax['rate'] / 100, user_price_dec());
}
}
}