add inventory total price, rename procurement purchase price
This commit is contained in:
@@ -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'){
|
||||
|
||||
Reference in New Issue
Block a user