Add inventory changes ( tax, net purchase price
This commit is contained in:
@@ -123,16 +123,14 @@ class InventoryItemForm extends Model{
|
||||
$item->price_brutto = $this->product->sale_price;
|
||||
$item->type = InventoryItem::$TYPE_PRODUCT;
|
||||
$item->id_product = $this->product->id_product;
|
||||
$item->tax = $this->product->tax;
|
||||
$item->purchase_price_net = $this->product->purchase_net_price;
|
||||
}else{
|
||||
$item->id_inventory_group = $this->inventoryGroup->id_inventory_group;
|
||||
$item->type = InventoryItem::$TYPE_INVENTORY_GROUP;
|
||||
}
|
||||
$item->id_inventory = $this->inventory->id_inventory;
|
||||
|
||||
|
||||
$item->recalculateTotalPriceBrutto();
|
||||
|
||||
|
||||
|
||||
if ( !$item->save(false) ){
|
||||
throw new \Exception("Nem sikerült a leltár végrehajtása");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\InventoryItem;
|
||||
@@ -72,8 +71,10 @@ class InventoryItemSearch extends InventoryItem
|
||||
'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'),
|
||||
'inventory_item.purchase_price_net as item_purchase_price_net',
|
||||
'inventory_item.net_stock_money as item_net_stock_money',
|
||||
'inventory_item.stock_missing_count as item_stock_missing_count',
|
||||
'inventory_item.stock_missing_money as item_stock_missing_money'
|
||||
]);
|
||||
|
||||
$query->from(InventoryItem::tableName());
|
||||
@@ -91,11 +92,7 @@ class InventoryItemSearch extends InventoryItem
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
|
||||
$dataProvider = new ActiveDataProvider(
|
||||
['query' => $query ,
|
||||
@@ -117,12 +114,20 @@ class InventoryItemSearch extends InventoryItem
|
||||
['inventory.name', 'inventory_name'],
|
||||
['inventory_prev_name', 'inventory_prev_name'],
|
||||
['item_price_brutto', 'item_price_brutto'],
|
||||
['item_total_price_brutto', 'item_total_price_brutto'],
|
||||
['item_purchase_price_net', 'item_purchase_price_net'],
|
||||
['item_stock_missing_count', 'item_stock_missing_count'],
|
||||
['item_stock_missing_money', 'item_stock_missing_money'],
|
||||
])
|
||||
,
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
$query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
|
||||
if ( !empty($this->item_type) && is_numeric($this->item_id) ){
|
||||
|
||||
Reference in New Issue
Block a user