Computes a sale line total as quantity times price using bcmath, optionally subtracting the item discount when include_discount is true.
// Source: https://github.com/Pmbamungu/ospos | License: MIT | Copyright 2013-2021 jekkos
// Provided via justclaw.it.com; keep this notice with the code.
public function get_item_total($quantity, $price, $discount, $discount_type, $include_discount = FALSE)
{
$total = bcmul($quantity, $price);
if($include_discount)
{
$discount_amount = $this->get_item_discount($quantity, $price, $discount, $discount_type);
return bcsub($total, $discount_amount);
}
return $total;
}
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key