public function getFormAttribs() { return ['customer' => ['type' => TabularForm::INPUT_HIDDEN, 'columnOptions' => ['hidden' => true]], 'name' => ['type' => TabularForm::INPUT_STATIC], 'measurement_type' => ['type' => TabularForm::INPUT_STATIC, 'value' => function ($m, $k, $i, $w) { return MaterialTypes::$measurementType[$m->measurement_type]; }], 'price' => ['type' => TabularForm::INPUT_RAW, 'value' => function ($m, $k, $i, $w) { return Html::textInput("price[" . $k . "]", CustomerMaterialPrice::getPrice($k, $this->customer), ['class' => 'form-control']); }]]; }
public function actionGettripprice() { $material_id = $_POST['material']; $quantity = $_POST['quantity']; $customer_id = $_POST['customer']; $customerMaterialPrice = CustomerMaterialPrice::findOne(['customer_id' => $customer_id, 'material_id' => $material_id]); $price = $customerMaterialPrice->price; echo $total_price = $price * $quantity; }