public function actionBarangPrice() { if (Yii::$app->request->post('hasEditable')) { $idx = Yii::$app->request->post('editableKey'); Yii::$app->response->format = Response::FORMAT_JSON; $modelPrice = Barang::findOne($idx); $out = Json::encode(['output' => '', 'message' => '']); $post = []; $posted = current($_POST['Barang']); $post['Barang'] = $posted; if ($modelPrice->load($post)) { $output = ''; $modelPrice->save(); /* HARGA PABRIK */ if (isset($posted['HARGA_PABRIK'])) { $output = Yii::$app->formatter->asDecimal($modelPrice->HARGA_PABRIK, 0); } /* HARGA LG */ if (isset($posted['HARGA_LG'])) { $output = Yii::$app->formatter->asDecimal($modelPrice->HARGA_LG, 2); } /* HARGA SUPPLIER */ if (isset($posted['HARGA_DIST'])) { $output = $modelPrice->HARGA_DIST; } /* HARGA SALES LG */ if (isset($posted['HARGA_SALES'])) { $output = $modelPrice->HARGA_SALES; } $out = Json::encode(['output' => $output, 'message' => '']); } // return ajax json encoded response and exit echo $out; return; } $searchModel = new BarangSearch(); $dataProvider = $searchModel->searchBarang(Yii::$app->request->queryParams); $model = new Barang(); $querys = Barang::find()->from('dbc002.b0001 AS db1')->leftJoin('dbc002.b1001 AS db2', 'db1.KD_BARANG = db2.KD_TYPE')->where(['NM_TYPE' => 'FDSFDG'])->all(); return $this->render('price', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'querys' => $querys]); }