public function actionProductlist($search = null, $id = null)
 {
     $out = ['more' => false];
     if (!is_null($search)) {
         $query = new Query();
         $lowerchr = strtolower($search);
         $command = Yii::$app->db->createCommand("SELECT DISTINCT id, '[' || default_code || '] ' || name_template as text FROM product_product WHERE lower(name_template) LIKE '%" . $lowerchr . "%' OR lower(default_code) LIKE '%" . $lowerchr . "%' LIMIT 20");
         $data = $command->queryAll();
         $out['results'] = array_values($data);
     } elseif ($id > 0) {
         $ids = explode(',', $id);
         foreach ($ids as $value) {
             $data[] = ['id' => $value, 'text' => '[' . ProductProduct::find()->where(['id' => $value])->one()->default_code . '] ' . ProductProduct::find()->where(['id' => $value])->one()->name_template];
         }
         $out['results'] = $data;
     } else {
         $out['results'] = ['id' => 0, 'text' => 'No matching records found'];
     }
     echo Json::encode($out);
 }
 public function actionExportCsv($id)
 {
     $this->layout = 'export';
     $product = ProductProduct::find()->where(['id' => $id])->one();
     return $this->render('report/exportcsv', ['model' => $product]);
 }