add inventory total price, rename procurement purchase price

This commit is contained in:
2016-04-04 20:40:55 +02:00
parent a2dcdab49c
commit 5942a5f9f5
7 changed files with 97 additions and 15 deletions

View File

@@ -119,6 +119,7 @@ class InventoryItemForm extends Model{
$item->id_user = \Yii::$app->user->id;
if ( $this->type == 'product'){
$item->price_brutto = $this->product->sale_price;
$item->type = InventoryItem::$TYPE_PRODUCT;
$item->id_product = $this->product->id_product;
}else{
@@ -127,6 +128,10 @@ class InventoryItemForm extends Model{
}
$item->id_inventory = $this->inventory->id_inventory;
$model->recalculateTotalPriceBrutto();
if ( !$item->save(false) ){
throw new \Exception("Nem sikerült a leltár végrehajtása");
}