/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Glprep::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['glprep_id' => SORT_DESC]]]); $query->joinWith(['idPreparat']); $this->load($params); // Отображает список препаратов глаукомного пациента в его карте if (isset($params['id'])) { $Glaukuchet = Glaukuchet::findOne(['id_patient' => $params['id']]); $query->andFilterWhere(['id_glaukuchet' => empty($Glaukuchet) ? -1 : $Glaukuchet->primaryKey]); } else { $query->andFilterWhere(['id_glaukuchet' => -1]); } if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['glprep_id' => $this->glprep_id, 'id_glaukuchet' => $this->id_glaukuchet, 'id_preparat' => $this->id_preparat, 'glprep_rlocat' => $this->glprep_rlocat]); $query->andFilterWhere(['LIKE', 'idPreparat.preparat_name', $this->getAttribute('idPreparat.preparat_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idPreparat.preparat_name']); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TrRmMat::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['tr_rm_mat_id' => SORT_DESC]]]); $query->joinWith(['idTrMat.idMattraffic.idMaterial', 'idTrMat.idMattraffic.idMol.idperson', 'idTrMat.idMattraffic.idMol.iddolzh', 'idTrMat.idParent.idMaterial matparent', 'idTrMat.idParent.idMol molparent', 'idTrMat.idParent.idMol.idbuild', 'idTrMat.idParent.trOsnovs']); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['tr_rm_mat_id' => $this->tr_rm_mat_id, 'id_removeakt' => (string) filter_input(INPUT_GET, 'id'), 'id_tr_mat' => $this->id_tr_mat]); $query->andFilterWhere(['LIKE', 'matparent.material_name', $this->getAttribute('idTrMat.idParent.idMaterial.material_name')]); $query->andFilterWhere(['LIKE', 'matparent.material_inv', $this->getAttribute('idTrMat.idParent.idMaterial.material_inv')]); $query->andFilterWhere(['LIKE', 'matparent.material_serial', $this->getAttribute('idTrMat.idParent.idMaterial.material_serial')]); $query->andFilterWhere(['LIKE', 'idbuild.build_name', $this->getAttribute('idTrMat.idParent.idMol.idbuild.build_name')]); $query->andFilterWhere(['LIKE', 'idMaterial.material_name', $this->getAttribute('idTrMat.idMattraffic.idMaterial.material_name')]); $query->andFilterWhere(['LIKE', 'idMaterial.material_inv', $this->getAttribute('idTrMat.idMattraffic.idMaterial.material_inv')]); $query->andFilterWhere(Proc::WhereConstruct($this, 'idTrMat.idMattraffic.mattraffic_number')); $query->andFilterWhere(['LIKE', 'idperson.auth_user_fullname', $this->getAttribute('idTrMat.idMattraffic.idMol.idperson.auth_user_fullname')]); $query->andFilterWhere(['LIKE', 'iddolzh.dolzh_name', $this->getAttribute('idTrMat.idMattraffic.idMol.iddolzh.dolzh_name')]); $query->andFilterWhere(['LIKE', 'trOsnovs.tr_osnov_kab', $this->getAttribute('idTrMat.idParent.trOsnovs.tr_osnov_kab')]); Proc::AssignRelatedAttributes($dataProvider, ['idTrMat.idParent.idMaterial.material_name' => 'matparent', 'idTrMat.idParent.idMaterial.material_inv' => 'matparent', 'idTrMat.idParent.idMaterial.material_serial' => 'matparent', 'idTrMat.idParent.idMol.idbuild.build_name', 'idTrMat.idMattraffic.idMaterial.material_name', 'idTrMat.idMattraffic.idMaterial.material_inv', 'idTrMat.idMattraffic.mattraffic_number', 'idTrMat.idMattraffic.idMol.idperson.auth_user_fullname', 'idTrMat.idMattraffic.idMol.iddolzh.dolzh_name', 'idTrMat.idParent.trOsnovs.tr_osnov_kab']); return $dataProvider; }
public function search($params) { $query = Osmotraktmat::find(); $query->select(['osmotraktmat_id', 'osmotraktmat_date', 'id_master', 'count(trMatOsmotrs.tr_mat_osmotr_id) AS osmotraktmat_countmat']); $query->joinWith(['idMaster.idperson idmasterperson', 'idMaster.iddolzh idmasterdolzh', 'trMatOsmotrs']); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id_master' => $this->id_master]); $query->andFilterWhere(Proc::WhereConstruct($this, 'osmotraktmat_id')); $query->andFilterWhere(Proc::WhereConstruct($this, 'osmotraktmat_date', Proc::Date)); $query->groupBy(['osmotraktmat_id']); if (!empty($this->osmotraktmat_countmat)) { $w = Proc::WhereConstruct($this, 'osmotraktmat_countmat'); $query->having('count(osmotraktmat_id) ' . $w[0] . $w[2]); } Proc::AssignRelatedAttributes($dataProvider, ['idMaster.idperson.auth_user_fullname', 'idMaster.iddolzh.dolzh_name']); $dataProvider->sort->attributes['osmotraktmat_countmat'] = ['asc' => ['count(osmotraktmat_id)' => SORT_ASC], 'desc' => ['count(osmotraktmat_id)' => SORT_DESC]]; return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Spisosnovakt::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith(['idMol.idperson idpersonmol', 'idMol.iddolzh iddolzhmol', 'idMol.idpodraz idpodrazmol', 'idEmployee.idperson', 'idEmployee.iddolzh', 'idSchetuchet']); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id_schetuchet' => $this->id_schetuchet, 'id_mol' => $this->id_mol, 'id_employee' => $this->id_employee]); $query->andFilterWhere(Proc::WhereConstruct($this, 'spisosnovakt_id')); $query->andFilterWhere(Proc::WhereConstruct($this, 'spisosnovakt_date', Proc::Date)); $query->andFilterWhere(['LIKE', 'idpersonmol.auth_user_fullname', $this->getAttribute('idMol.idperson.auth_user_fullname')]); $query->andFilterWhere(['LIKE', 'iddolzhmol.dolzh_name', $this->getAttribute('idMol.iddolzh.dolzh_name')]); $query->andFilterWhere(['LIKE', 'idpodrazmol.podraz_name', $this->getAttribute('idMol.idpodraz.podraz_name')]); $query->andFilterWhere(['LIKE', 'idperson.auth_user_fullname', $this->getAttribute('idEmployee.idperson.auth_user_fullname')]); $query->andFilterWhere(['LIKE', 'iddolzh.dolzh_name', $this->getAttribute('idEmployee.iddolzh.dolzh_name')]); $query->andFilterWhere(['LIKE', 'idSchetuchet.schetuchet_kod', $this->getAttribute('idSchetuchet.schetuchet_kod')]); $query->andFilterWhere(['LIKE', 'idSchetuchet.schetuchet_name', $this->getAttribute('idSchetuchet.schetuchet_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idMol.idperson.auth_user_fullname' => 'idpersonmol', 'idMol.iddolzh.dolzh_name' => 'iddolzhmol', 'idMol.idpodraz.podraz_name' => 'idpodrazmol', 'idEmployee.idperson.auth_user_fullname', 'idEmployee.iddolzh.dolzh_name', 'idSchetuchet.schetuchet_kod', 'idSchetuchet.schetuchet_name']); return $dataProvider; }
public function actionSettings() { $model = Fregatsettings::findOne(1); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { return $this->render('//Fregat/config/settingsupdate', ['model' => $model]); } }
public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { return $this->render('update', ['model' => $model]); } }
public function actionToexcel() { $searchModel = new ImportemployeeSearch(); $params = Yii::$app->request->queryParams; $inputdata = json_decode($params['inputdata']); $modelname = $searchModel->formName(); $dataProvider = $searchModel->search(Proc::GetArrayValuesByKeyName($modelname, $inputdata)); Proc::Grid2Excel($dataProvider, $modelname, 'Импорт сотрудников'); }
public function actionCreate($idglaukuchet) { $model = new Glprep(); $model->id_glaukuchet = $idglaukuchet; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { return $this->render('create', ['model' => $model, 'idglaukuchet' => $idglaukuchet]); } }
/** * Deletes an existing RramatDocfiles model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { if (Yii::$app->request->isAjax) { $ar = $this->findModel($id); $id_docfiles = $ar->id_docfiles; if ($ar->delete()) { Proc::DeleteDocFile($id_docfiles); } } }
public function actionIndex() { $searchModel = new LogreportSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $Importconfig = Importconfig::findOne(1); if ($Importconfig->load(Yii::$app->request->post()) && $Importconfig->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { return $this->render('index', ['Importconfig' => $Importconfig, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } }
/** * Updates an existing Spisosnovakt model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { $searchModel = new SpisosnovmaterialsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('update', ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } }
public function selectinput($params) { $method = isset($params['init']) ? 'one' : 'all'; // Меняем раскладку на английскую при вводе МКБ10 if ($method === 'all') { preg_match('/^([а-яА-Я]\\d)/ui', $params['q'], $match); if (!empty($match[1])) { $params['q'] = Proc::switcher($params['q']); } } $query = self::find()->select(array_merge(isset($params['init']) ? [] : [self::primaryKey()[0] . ' AS id'], ['CONCAT_WS(" - ", code, name) AS text']))->where(['node_count' => 0])->andwhere(['or', ['like', isset($params['init']) ? 'id' : 'code', $params['q'], isset($params['init']) ? false : null], $method === 'all' ? ['like', 'name', $params['q']] : '1<>1'])->andwhere(['or', ['like', 'code', 'H40%', false], ['like', 'code', 'Q15.0', false]])->limit(10)->asArray()->{$method}(); return $query; }
public function actionUpdate($id) { $model = $this->findModel($id); $UploadFile = new UploadDocFile(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { $searchModelrramat = new RramatDocfilesSearch(); $dataProviderrramat = $searchModelrramat->search(Yii::$app->request->queryParams); $searchModel = new RecoveryrecieveaktmatSearch(); $dataProvider = $searchModel->searchbase(Yii::$app->request->queryParams); return $this->render('update', ['model' => $model, 'UploadFile' => $UploadFile, 'dataProvider' => $dataProvider, 'searchModelrramat' => $searchModelrramat, 'dataProviderrramat' => $dataProviderrramat]); } }
public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession()); } else { $Request = Yii::$app->request->queryParams; $searchModelOsn = new TrOsnovSearch(); $dataProviderOsn = $searchModelOsn->search($Request); $searchModelMat = new TrMatSearch(); $dataProviderMat = $searchModelMat->search($Request); return $this->render('update', ['model' => $model, 'searchModelOsn' => $searchModelOsn, 'dataProviderOsn' => $dataProviderOsn, 'searchModelMat' => $searchModelMat, 'dataProviderMat' => $dataProviderMat]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Grupavid::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith(['idmatvid']); $this->load($params); $this->id_grupa = $params['id']; if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['grupavid_id' => $this->grupavid_id, 'grupavid_main' => $this->grupavid_main, 'id_grupa' => $this->id_grupa, 'id_matvid' => $this->id_matvid]); $query->andFilterWhere(['LIKE', 'idmatvid.matvid_name', $this->getAttribute('idmatvid.matvid_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idmatvid.matvid_name']); return $dataProvider; }
public function searchforgrupavid($params) { $query = Matvid::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['matvid_name' => SORT_ASC]]]); $query->joinWith(['grupavids']); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['matvid_id' => $this->matvid_id]); $query->andFilterWhere(['like', 'matvid_name', $this->matvid_name]); $query->andFilterWhere(['like', 'grupavids.grupa_main', $this->getAttribute('grupavids.grupa_main')]); Proc::AssignRelatedAttributes($dataProvider, ['grupavids.grupa_main']); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Importmaterial::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['importmaterial_combination' => SORT_ASC]]]); $query->joinWith(['idmatvid']); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['importmaterial_id' => $this->importmaterial_id, 'id_matvid' => $this->id_matvid]); $query->andFilterWhere(['like', 'importmaterial_combination', $this->importmaterial_combination]); $query->andFilterWhere(['LIKE', 'idmatvid.matvid_name', $this->getAttribute('idmatvid.matvid_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idmatvid.matvid_name']); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Authitemchild::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith(['children']); $this->load($params); $this->parent = $params['id']; if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['like', 'parent', $this->parent])->andFilterWhere(['like', 'child', $this->child]); $query->andFilterWhere(['LIKE', 'children.description', $this->getAttribute('children.description')]); $query->andFilterWhere(['LIKE', 'children.type', $this->getAttribute('children.type')]); $query->andFilterWhere(['LIKE', 'children.name', $this->getAttribute('children.name')]); Proc::AssignRelatedAttributes($dataProvider, ['children.description', 'children.type', 'children.name']); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Authassignment::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith(['itemname']); $this->load($params); $this->user_id = $params['id']; if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['user_id' => $this->user_id, 'created_at' => $this->created_at]); $query->andFilterWhere(['like', 'item_name', $this->item_name]); $query->andFilterWhere(['LIKE', 'itemname.description', $this->getAttribute('itemname.description')]); $query->andFilterWhere(['LIKE', 'itemname.type', $this->getAttribute('itemname.type')]); $query->andFilterWhere(['LIKE', 'itemname.name', $this->getAttribute('itemname.name')]); Proc::AssignRelatedAttributes($dataProvider, ['itemname.description', 'itemname.type', 'itemname.name']); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Removeakt::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['removeakt_id' => SORT_DESC]]]); $query->joinWith(['idRemover.idperson', 'idRemover.iddolzh']); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['removeakt_id' => $this->removeakt_id, 'id_remover' => $this->id_remover]); $query->andFilterWhere(Proc::WhereConstruct($this, 'removeakt_date', Proc::Date)); $query->andFilterWhere(['LIKE', 'idperson.auth_user_fullname', $this->getAttribute('idRemover.idperson.auth_user_fullname')]); $query->andFilterWhere(['LIKE', 'iddolzh.dolzh_name', $this->getAttribute('idRemover.iddolzh.dolzh_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idRemover.idperson.auth_user_fullname', 'idRemover.iddolzh.dolzh_name']); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = RramatDocfiles::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith('idDocfiles'); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['rramat_docfiles_id' => $this->rramat_docfiles_id, 'id_docfiles' => $this->id_docfiles, 'id_recoveryrecieveaktmat' => $params['id']]); $query->andFilterWhere(['LIKE', 'idDocfiles.docfiles_ext', $this->getAttribute('idDocfiles.docfiles_ext')]); $query->andFilterWhere(['LIKE', 'idDocfiles.docfiles_name', $this->getAttribute('idDocfiles.docfiles_name')]); $query->andFilterWhere(['LIKE', 'idDocfiles.docfiles_hash', $this->getAttribute('idDocfiles.docfiles_hash')]); Proc::AssignRelatedAttributes($dataProvider, ['idDocfiles.docfiles_ext', 'idDocfiles.docfiles_name', 'idDocfiles.docfiles_hash']); return $dataProvider; }
public function searchForimportemployee($params) { $query = Impemployee::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['idemployee.idperson.auth_user_fullname' => SORT_ASC]]]); $query->joinWith(['idemployee.iddolzh', 'idemployee.idpodraz', 'idemployee.idbuild']); $this->load($params); $this->id_importemployee = $params['id']; if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['impemployee_id' => $this->impemployee_id, 'id_importemployee' => $this->id_importemployee, 'id_employee' => $this->id_employee]); $query->andFilterWhere(['LIKE', 'idemployee.employee_id', $this->getAttribute('idemployee.employee_id')]); $query->andFilterWhere(['LIKE', 'iddolzh.dolzh_name', $this->getAttribute('idemployee.iddolzh.dolzh_name')]); $query->andFilterWhere(['LIKE', 'idpodraz.podraz_name', $this->getAttribute('idemployee.idpodraz.podraz_name')]); $query->andFilterWhere(['LIKE', 'idbuild.build_name', $this->getAttribute('idemployee.idbuild.build_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idemployee.employee_id', 'idemployee.iddolzh.dolzh_name', 'idemployee.idbuild.build_name', 'idemployee.idpodraz.podraz_name']); return $dataProvider; }
public function search($params) { $query = Logreport::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['logreport_id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_id')); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_executetime', Proc::Time)); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_date', Proc::Date)); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_errors')); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_updates')); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_additions')); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_amount')); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_missed')); $query->andFilterWhere(Proc::WhereConstruct($this, 'logreport_memoryused')); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Authitem::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['type' => $this->type, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'rule_name', $this->rule_name])->andFilterWhere(['like', 'data', $this->data]); $filter = Proc::GetFilter('AuthitemSearch', 'AuthitemFilter'); if (!empty($filter)) { $attr = 'onlyrootauthitems_mark'; if ($filter[$attr] === '1') { $query->joinWith('authitemchildrenparent')->where('(not parent in (select b.child from auth_item_child b) or (parent Is Null))')->andFilterWhere(['type' => 1])->groupBy(['name', 'type', 'description']); } } return $dataProvider; }
/** * Creates a new Docfiles model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (Yii::$app->request->isAjax && Yii::$app->request->isPost) { $model = new UploadDocFile(); $model->docFile = UploadedFile::getInstance($model, 'docFile'); $UploadTrigger = $model->upload(); if ($UploadTrigger['success']) { $Docfiles = new Docfiles(); $Docfiles->docfiles_hash = $UploadTrigger['savedhashfilename_utf8']; $Docfiles->docfiles_name = $UploadTrigger['savedfilename']; $Docfiles->docfiles_ext = $UploadTrigger['fileextension']; if ($Docfiles->save()) { echo json_encode(['ok']); } else { throw new HttpException(500, Proc::ActiveRecordErrorsToString($Docfiles)); } } else { throw new HttpException(500, Proc::ActiveRecordErrorsToString($UploadTrigger['errors'])); } } else { throw new HttpException(500, 'Ошибка запроса'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Spisosnovmaterials::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith(['idMattraffic.idMaterial']); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['spisosnovmaterials_id' => $this->spisosnovmaterials_id, 'id_mattraffic' => $this->id_mattraffic, 'id_spisosnovakt' => $this->id_spisosnovakt]); $query->andFilterWhere(Proc::WhereConstruct($this, 'spisosnovmaterials_number')); $query->andFilterWhere(['LIKE', 'idMaterial.material_name', $this->getAttribute('idMattraffic.idMaterial.material_name')]); $query->andFilterWhere(['LIKE', 'idMaterial.material_inv', $this->getAttribute('idMattraffic.idMaterial.material_inv')]); $query->andFilterWhere(['LIKE', 'idMaterial.material_serial', $this->getAttribute('idMattraffic.idMaterial.material_serial')]); $query->andFilterWhere(Proc::WhereConstruct($this, 'idMattraffic.idMaterial.material_release', Proc::Date)); $query->andFilterWhere(Proc::WhereConstruct($this, 'idMattraffic.idMaterial.material_price')); Proc::AssignRelatedAttributes($dataProvider, ['idMattraffic.idMaterial.material_name', 'idMattraffic.idMaterial.material_inv', 'idMattraffic.idMaterial.material_serial', 'idMattraffic.idMaterial.material_release', 'idMattraffic.idMaterial.material_price']); return $dataProvider; }
private function recoverysendaktDopFilter(&$query) { $filter = Proc::GetFilter($this->formName(), 'RecoverysendaktFilter'); if (!empty($filter)) { $attr = 'mat_id_material'; Proc::Filter_Compare(Proc::Strict, $query, $filter, ['Attribute' => $attr, 'SQLAttribute' => 'idMattraffic.id_material', 'ExistsSubQuery' => (new Query())->select('recoveryrecieveakts.id_recoverysendakt')->from('recoveryrecieveakt recoveryrecieveakts')->leftJoin('osmotrakt idOsmotrakt', 'idOsmotrakt.osmotrakt_id = recoveryrecieveakts.id_osmotrakt')->leftJoin('tr_osnov idTrosnov', 'idOsmotrakt.id_tr_osnov = idTrosnov.tr_osnov_id')->leftJoin('mattraffic idMattraffic', 'idMattraffic.mattraffic_id = idTrosnov.id_mattraffic')->andWhere('recoveryrecieveakts.id_recoverysendakt = recoverysendakt.recoverysendakt_id')]); $attr = 'recoverysendakt_closed_mark'; if ($filter[$attr] === '1') { Proc::Filter_Compare(Proc::WhereStatement, $query, $filter, ['Attribute' => $attr, 'WhereStatement' => ['not exists', (new Query())->select('rsa.recoverysendakt_id')->from('recoverysendakt rsa')->leftJoin('recoveryrecieveakt rra', 'rsa.recoverysendakt_id = rra.id_recoverysendakt')->leftJoin('recoveryrecieveaktmat rramat', 'rsa.recoverysendakt_id = rramat.id_recoverysendakt')->andWhere(['rra.recoveryrecieveakt_repaired' => NULL])->andWhere(['rramat.recoveryrecieveaktmat_repaired' => NULL])->andWhere('rsa.recoverysendakt_id = recoverysendakt.recoverysendakt_id')]]); } $attr = 'recoverysendakt_opened_mark'; if ($filter[$attr] === '1') { Proc::Filter_Compare(Proc::WhereStatement, $query, $filter, ['Attribute' => $attr, 'WhereStatement' => ['exists', (new Query())->select('rsa.recoverysendakt_id')->from('recoverysendakt rsa')->leftJoin('recoveryrecieveakt rra', 'rsa.recoverysendakt_id = rra.id_recoverysendakt')->leftJoin('recoveryrecieveaktmat rramat', 'rsa.recoverysendakt_id = rramat.id_recoverysendakt')->andWhere(['rra.recoveryrecieveakt_repaired' => NULL])->andWhere(['rramat.recoveryrecieveaktmat_repaired' => NULL])->andWhere('rsa.recoverysendakt_id = recoverysendakt.recoverysendakt_id')]]); } $attr = 'recoveryrecieveakt_repaired'; Proc::Filter_Compare(Proc::WhereStatement, $query, $filter, ['Attribute' => $attr, 'WhereStatement' => ['exists', (new Query())->select('rsa.recoverysendakt_id')->from('recoverysendakt rsa')->leftJoin('recoveryrecieveakt rra', 'rsa.recoverysendakt_id = rra.id_recoverysendakt')->leftJoin('recoveryrecieveaktmat rramat', 'rsa.recoverysendakt_id = rramat.id_recoverysendakt')->andWhere(['or', ['rra.recoveryrecieveakt_repaired' => $filter[$attr]], ['rramat.recoveryrecieveaktmat_repaired' => $filter[$attr]]])->andWhere('rsa.recoverysendakt_id = recoverysendakt.recoverysendakt_id')]]); $attr = 'mol_id_person'; Proc::Filter_Compare(Proc::Strict, $query, $filter, ['Attribute' => $attr, 'SQLAttribute' => 'idMol.id_person', 'ExistsSubQuery' => (new Query())->select('recoveryrecieveakts.id_recoverysendakt')->from('recoveryrecieveakt recoveryrecieveakts')->leftJoin('osmotrakt idOsmotrakt', 'idOsmotrakt.osmotrakt_id = recoveryrecieveakts.id_osmotrakt')->leftJoin('tr_osnov idTrosnov', 'idOsmotrakt.id_tr_osnov = idTrosnov.tr_osnov_id')->leftJoin('mattraffic idMattraffic', 'idMattraffic.mattraffic_id = idTrosnov.id_mattraffic')->leftJoin('employee idMol', 'idMattraffic.id_mol = idMol.employee_id')->andWhere('recoveryrecieveakts.id_recoverysendakt = recoverysendakt.recoverysendakt_id')]); $attr = 'mat_id_material_mat'; Proc::Filter_Compare(Proc::Strict, $query, $filter, ['Attribute' => $attr, 'SQLAttribute' => 'idMattraffic.id_material', 'ExistsSubQuery' => (new Query())->select('recoveryrecieveaktmats.id_recoverysendakt')->from('recoveryrecieveaktmat recoveryrecieveaktmats')->leftJoin('tr_mat_osmotr idTrMatOsmotr', 'idTrMatOsmotr.tr_mat_osmotr_id = recoveryrecieveaktmats.id_tr_mat_osmotr')->leftJoin('tr_mat idTrMat', 'idTrMat.tr_mat_id = idTrMatOsmotr.id_tr_mat')->leftJoin('mattraffic idMattraffic', 'idMattraffic.mattraffic_id = idTrMat.id_mattraffic')->andWhere('recoveryrecieveaktmats.id_recoverysendakt = recoverysendakt.recoverysendakt_id')]); $attr = 'mol_id_person_mat'; Proc::Filter_Compare(Proc::Strict, $query, $filter, ['Attribute' => $attr, 'SQLAttribute' => 'idMol.id_person', 'ExistsSubQuery' => (new Query())->select('recoveryrecieveaktmats.id_recoverysendakt')->from('recoveryrecieveaktmat recoveryrecieveaktmats')->leftJoin('tr_mat_osmotr idTrMatOsmotr', 'idTrMatOsmotr.tr_mat_osmotr_id = recoveryrecieveaktmats.id_tr_mat_osmotr')->leftJoin('tr_mat idTrMat', 'idTrMat.tr_mat_id = idTrMatOsmotr.id_tr_mat')->leftJoin('mattraffic idMattraffic', 'idMattraffic.mattraffic_id = idTrMat.id_mattraffic')->leftJoin('employee idMol', 'idMattraffic.id_mol = idMol.employee_id')->andWhere('recoveryrecieveaktmats.id_recoverysendakt = recoverysendakt.recoverysendakt_id')]); } }
<?php use yii\helpers\Html; use app\func\Proc; /* @var $this yii\web\View */ /* @var $model app\models\Fregat\Recoverysendakt */ $this->title = 'Добавить акт восстановления материальных ценностей'; $this->params['breadcrumbs'] = Proc::Breadcrumbs($this, ['model' => $model]); ?> <div class="recoverysendakt-create"> <div class="panel panel-<?php echo Yii::$app->params['panelStyle']; ?> "> <div class="panel-heading base-heading"><?php echo Html::encode($this->title); ?> </div> <div class="panel-body"> <?php echo $this->render('_form', ['model' => $model]); ?> </div> </div> </div>
<?php use yii\helpers\Html; use kartik\dynagrid\DynaGrid; use app\func\Proc; use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $searchModel app\models\Fregat\TrMatSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Установленные комплектующие'; $this->params['breadcrumbs'] = Proc::Breadcrumbs($this); ?> <div class="tr-mat-index"> <?php $result = Proc::GetLastBreadcrumbsFromSession(); $foreign = isset($result['dopparams']['foreign']) ? $result['dopparams']['foreign'] : ''; echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'trmatgrid'], 'columns' => Proc::DGcols(['columns' => ['idMattraffic.idMaterial.material_name', 'idMattraffic.idMaterial.material_inv', 'idMattraffic.mattraffic_number', ['attribute' => 'idParent.idMaterial.material_name', 'label' => 'Укомплекторано в мат-ую цен-ть'], ['attribute' => 'idParent.idMaterial.material_inv', 'label' => 'Инвентарный номер мат-ой цен-ти, в которую укомплектован материал'], ['attribute' => 'idParent.idMol.idbuild.build_name', 'label' => 'Здание, где установлено'], ['attribute' => 'idParent.trOsnovs.tr_osnov_kab', 'label' => 'Кабинет, где установлено', 'value' => function ($model) { return $model->idParent->trOsnovs[0]->tr_osnov_kab; }], ['attribute' => 'idMattraffic.idMol.idperson.auth_user_fullname', 'label' => 'ФИО материально-ответственного лица'], ['attribute' => 'idMattraffic.idMol.iddolzh.dolzh_name', 'label' => 'Должность материально-ответственного лица']], 'buttons' => array_merge(empty($foreign) ? [] : ['chooseajax' => ['Fregat/tr-mat/assign-to-grid']])]), 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<i class="glyphicon glyphicon-align-paste"></i> ' . $this->title]]])); ?> </div>
<?php use yii\helpers\Html; use app\func\Proc; use kartik\dynagrid\DynaGrid; /* @var $this yii\web\View */ /* @var $searchModel app\models\Fregat\TrOsnovSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Установленные материальные ценности'; $this->params['breadcrumbs'] = Proc::Breadcrumbs($this); ?> <div class="tr-osnov-index"> <?php $result = Proc::GetLastBreadcrumbsFromSession(); $foreign = isset($result['dopparams']['foreign']) ? $result['dopparams']['foreign'] : ''; echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'tr-osnovgrid'], 'columns' => Proc::DGcols(['buttonsfirst' => true, 'columns' => ['idInstallakt.installakt_id', ['attribute' => 'idInstallakt.installakt_date', 'format' => 'date'], 'idMattraffic.idMaterial.material_name', 'idMattraffic.idMaterial.material_inv', 'idMattraffic.idMaterial.material_serial', 'idMattraffic.idMol.idbuild.build_name', 'tr_osnov_kab', ['attribute' => 'idMattraffic.idMol.idperson.auth_user_fullname', 'label' => 'ФИО материально-ответственного лица'], 'idMattraffic.idMol.iddolzh.dolzh_name'], 'buttons' => array_merge(empty($foreign) ? [] : ['chooseajax' => ['Fregat/tr-osnov/assign-to-select2']])]), 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<i class="glyphicon glyphicon-pushpin"></i> ' . $this->title]]])); ?> </div>