Don't round up missing amounts and allow decimal numbers (fixes #758)

This commit is contained in:
Bernd Bestel 2020-08-24 20:16:21 +02:00
parent 9d04d81744
commit ece880ea44
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,10 @@
- Fixed that location & product groups filter on the stock overview page did a contains search instead an exact search - Fixed that location & product groups filter on the stock overview page did a contains search instead an exact search
- Fixed that the amount on the success popup was wrong when consuming a product with "Tare weight handling" enabled - Fixed that the amount on the success popup was wrong when consuming a product with "Tare weight handling" enabled
### Shopping list improvements
- "Add products that are below defined min. stock amount" always rounded up the missing amount to an integral number, this now allows decimal numbers
### Recipe improvements/fixes ### Recipe improvements/fixes
- It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett) - It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett)
- Improved recipe card presentation (thanks @zsarnett) - Improved recipe card presentation (thanks @zsarnett)

View File

@ -856,7 +856,7 @@ class StockService extends BaseService
foreach ($missingProducts as $missingProduct) foreach ($missingProducts as $missingProduct)
{ {
$product = $this->getDatabase()->products()->where('id', $missingProduct->id)->fetch(); $product = $this->getDatabase()->products()->where('id', $missingProduct->id)->fetch();
$amountToAdd = ceil($missingProduct->amount_missing / $product->qu_factor_purchase_to_stock); $amountToAdd = round($missingProduct->amount_missing / $product->qu_factor_purchase_to_stock, 2);
$alreadyExistingEntry = $this->getDatabase()->shopping_list()->where('product_id', $missingProduct->id)->fetch(); $alreadyExistingEntry = $this->getDatabase()->shopping_list()->where('product_id', $missingProduct->id)->fetch();
if ($alreadyExistingEntry) // Update if ($alreadyExistingEntry) // Update