Added price field on inventory page (for added products) (references #225)

This commit is contained in:
Bernd Bestel
2019-05-03 22:11:20 +02:00
parent 8138dd43ac
commit bcae9f9292
5 changed files with 40 additions and 3 deletions

View File

@@ -303,7 +303,7 @@ class StockService extends BaseService
}
}
public function InventoryProduct(int $productId, int $newAmount, string $bestBeforeDate, $locationId = null)
public function InventoryProduct(int $productId, int $newAmount, string $bestBeforeDate, $locationId = null, $price = null)
{
if (!$this->ProductExists($productId))
{
@@ -312,6 +312,11 @@ class StockService extends BaseService
$productDetails = (object)$this->GetProductDetails($productId);
if ($price === null)
{
$price = $productDetails->last_price;
}
// Tare weight handling
// The given amount is the new total amount including the container weight (gross)
// So assume that the amount in stock is the amount also including the container weight
@@ -333,7 +338,7 @@ class StockService extends BaseService
$bookingAmount = $newAmount;
}
$this->AddProduct($productId, $bookingAmount, $bestBeforeDate, self::TRANSACTION_TYPE_INVENTORY_CORRECTION, date('Y-m-d'), $productDetails->last_price, $locationId);
$this->AddProduct($productId, $bookingAmount, $bestBeforeDate, self::TRANSACTION_TYPE_INVENTORY_CORRECTION, date('Y-m-d'), $price, $locationId);
}
else if ($newAmount < $productDetails->stock_amount + $containerWeight)
{