fix: sales quantity should use rounded float numbers
This commit is contained in:
@@ -125,7 +125,7 @@ class Transaction extends Model
|
|||||||
|
|
||||||
public function scopeBeforeDate($query, $date)
|
public function scopeBeforeDate($query, $date)
|
||||||
{
|
{
|
||||||
return $query->whereDate('date', '<', $date);
|
return $query->whereDate('date', '<=', $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeMyTransactions()
|
public function scopeMyTransactions()
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class QuantityValidationRule implements ValidationRule
|
|||||||
|
|
||||||
$maxQuantity = $purchase_qty - $sales_qty;
|
$maxQuantity = $purchase_qty - $sales_qty;
|
||||||
|
|
||||||
if ($value > $maxQuantity) {
|
if (round($value, 3) > round($maxQuantity, 3)) {
|
||||||
$fail(__('The quantity must not be greater than the available quantity.'));
|
$fail(__('The quantity must not be greater than the available quantity.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user