Add inventory changes ( tax, net purchase price

This commit is contained in:
2017-01-06 18:24:43 +01:00
parent 6de07dac93
commit f3d00953c8
16 changed files with 547 additions and 287 deletions

View File

@@ -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) ){