Allow decimal amounts in general for the shopping list

This commit is contained in:
Bernd Bestel
2020-08-24 20:25:50 +02:00
parent ece880ea44
commit 3b564294e3
5 changed files with 9 additions and 18 deletions

View File

@@ -38,10 +38,10 @@ class RecipesService extends BaseService
{
$product = $this->getDataBase()->products($recipePosition->product_id);
$toOrderAmount = ceil(($recipePosition->missing_amount - $recipePosition->amount_on_shopping_list) / $product->qu_factor_purchase_to_stock);
$toOrderAmount = round(($recipePosition->missing_amount - $recipePosition->amount_on_shopping_list) / $product->qu_factor_purchase_to_stock, 2);
if ($recipe->not_check_shoppinglist == 1)
{
$toOrderAmount = ceil($recipePosition->missing_amount / $product->qu_factor_purchase_to_stock);
$toOrderAmount = round($recipePosition->missing_amount / $product->qu_factor_purchase_to_stock, 2);
}
if($toOrderAmount > 0)

View File

@@ -905,7 +905,7 @@ class StockService extends BaseService
if ($productRow != null && !empty($productRow))
{
$newAmount = $productRow->amount - $amount;
if ($newAmount < 1)
if ($newAmount < 0.01)
{
$productRow->delete();
}