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");
}

View File

@@ -71,6 +71,8 @@ class InventoryItemSearch extends InventoryItem
'inventory.created_at as inventory_created_at',
'inventory_prev.id_inventory as inventory_prev_id_inventory',
'inventory_prev.name as inventory_prev_name',
'inventory_item.price_brutto as item_price_brutto',
'inventory_item.total_price_brutto as item_total_price_brutto',
new Expression('(coalesce(inventory_item.count,0) - ( coalesce(inventory_item.count_prev,0) + coalesce(inventory_item.count_in,0) - coalesce(inventory_item.count_sold,0) )) as item_difference'),
]);
@@ -114,6 +116,8 @@ class InventoryItemSearch extends InventoryItem
['inventory.id_inventory', 'inventory_id_inventory'],
['inventory.name', 'inventory_name'],
['inventory_prev_name', 'inventory_prev_name'],
['item_price_brutto', 'item_price_brutto'],
['item_total_price_brutto', 'item_total_price_brutto'],
])
,
]