mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-27 10:31:50 -04:00
Fix (yet again) registry "complete" issue with rounding
This commit is contained in:
@@ -410,13 +410,16 @@ class Sale_lib
|
||||
$current_due = $amount_due;
|
||||
}
|
||||
|
||||
// 0 decimal -> 1 / 2 = 0.5, 1 decimals -> 0.1 / 2 = 0.05, 2 decimals -> 0.01 / 2 = 0.005
|
||||
$threshold = bcpow(10, -$this->CI->config->item('currency_decimals')) / 2;
|
||||
|
||||
if($this->get_mode() == 'return')
|
||||
{
|
||||
$totals['payments_cover_total'] = $current_due >= 0;
|
||||
$totals['payments_cover_total'] = $current_due > -$threshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
$totals['payments_cover_total'] = $current_due <= 0;
|
||||
$totals['payments_cover_total'] = $current_due < $threshold;
|
||||
}
|
||||
|
||||
return $totals;
|
||||
@@ -436,19 +439,6 @@ class Sale_lib
|
||||
return $rounded_due == 0 ? 0 : $amount_due;
|
||||
}
|
||||
|
||||
public function is_payment_covering_total()
|
||||
{
|
||||
|
||||
if($this->get_mode() == 'return')
|
||||
{
|
||||
return $this->get_amount_due() >= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->get_amount_due() <= 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_customer()
|
||||
{
|
||||
if(!$this->CI->session->userdata('sales_customer'))
|
||||
|
||||
Reference in New Issue
Block a user