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

@@ -33,7 +33,7 @@ return [
'Procurement' => 'Beszerzés',
'Procurements' => 'Beszerzések',
'Product name, product number or barcode' => 'Termék neve, termék száma vagy vonalkód',
'Purchase Price' => 'Beszerzési ár',
'Purchase Price' => 'Bevételezési ár(össz.)',
'Search' => 'Keresés',
'Stock' => 'Beszerzés előtti raktárkészlet',
'Update' => 'Módosítás',

View File

@@ -24,6 +24,8 @@ use common\components\ProductAwareBehavior;
* @property integer $id_user
* @property integer $id_inventory_item_prev
* @property integer $id_user
* @property integer $price_brutto
* @property integer $total_price_brutto
* @property string $created_at
* @property string $updated_at
*/
@@ -155,6 +157,20 @@ class InventoryItem extends BaseFitnessActiveRecord
}
public function recalculateTotalPriceBrutto(){
$diff = $this->difference;
if (!isset($diff) || !is_numeric($diff)){
$diff = 0;
}
$price = $this->price_brutto;
if (!isset($price) || !is_numeric($price)){
$price = 0;
}
$this->total_price_brutto = $price * $diff;
}
public function afterSave($insert, $changedAttributes){
if ( !$insert ){
// if ( $this->type == 'product'){