public function actionDelete($id) { if (Yii::$app->request->isAjax) { $transaction = Yii::$app->db->beginTransaction(); try { TrOsnov::deleteAll(['id_installakt' => $id]); TrMat::deleteAll(['id_installakt' => $id]); echo $this->findModel($id)->delete(); $transaction->commit(); } catch (Exception $e) { $transaction->rollBack(); throw new Exception($e->getMessage() . ' Удаление невозможно.'); } } }
/** * @return \yii\db\ActiveQuery */ public function getIdTrMat() { return $this->hasOne(TrMat::className(), ['tr_mat_id' => 'id_tr_mat'])->from(['idTrMat' => TrMat::tableName()]); }
protected function Body() { $ID = $this->getDopparamID(); $this->setReportName('Акт снятия комплектующих с матер-ых цен-тей №' . $ID); $Removeakt = Removeakt::findOne($ID); $Trmat = TrMat::find()->innerJoinWith(['trRmMats'])->andWhere(['trRmMats.id_removeakt' => $ID])->GroupBy('id_parent')->all(); $objPHPExcel = $this->getObjPHPExcel(); $objPHPExcel->getActiveSheet()->setCellValue('A3', 'комплектующих № ' . $Removeakt->removeakt_id . ' от ' . Yii::$app->formatter->asDate($Removeakt->removeakt_date)); $num = 5; $c_Trmat = count($Trmat); if ($c_Trmat > 0) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Снятие комплектующих'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLE, 'A' . $num . ':K' . $num); $num++; foreach ($Trmat as $arm) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Материальная ценность'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLELEFT, 'A' . $num . ':K' . $num); $num++; $this->SetTitlebyArray(['№', 'Вид', 'Наименование', 'Инвентарный номер', 'Серийный номер', 'Год выпуска', 'Стоимость', 'Здание', 'Кабинет', 'Материально-ответственное лицо', 'Тип'], $num); $this->setStyle(self::$CAPTION, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $this->setColumnNumbers($num, 11); $this->setStyle(self::$NUMS, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $Matparent = TrOsnov::find()->joinWith(['idMattraffic', 'idInstallakt'])->andWhere(['idMattraffic.id_material' => $arm->id_parent])->orderBy(['idInstallakt.installakt_date' => SORT_DESC])->one(); $material_tip = Material::VariablesValues('material_tip'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 1); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $num, $arm->idParent->idMaterial->idMatv->matvid_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, $arm->idParent->idMaterial->material_name); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(3, $num, $arm->idParent->idMaterial->material_inv, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $num, $arm->idParent->idMaterial->material_serial); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $num, Yii::$app->formatter->asDate($arm->idParent->idMaterial->material_release, 'y')); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(6, $num, $arm->idParent->idMaterial->material_price, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $arm->idParent->idMol->idbuild->build_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $num, $arm->idParent->trOsnovs[0]->tr_osnov_kab); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $num, $arm->idParent->idMol->idperson->auth_user_fullname . ', ' . $arm->idParent->idMol->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $num, $material_tip[$arm->idParent->idMaterial->material_tip]); $this->setStyle(self::$DATA, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Снятые комплектующие'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLELEFT, 'A' . $num . ':K' . $num); $num++; $this->SetTitlebyArray(['№', 'Вид', 'Наименование', 'Инвентарный номер', 'Серийный номер', 'Кол-во', 'Единица измерения', 'Год выпуска', 'Стоимость', 'Материально-ответственное лицо', 'Тип'], $num); $this->setStyle(self::$CAPTION, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $this->setColumnNumbers($num, 11); $this->setStyle(self::$NUMS, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $MatbyParent = TrMat::find()->joinWith(['trRmMats'])->andWhere(['id_parent' => $arm->idParent->primaryKey, 'trRmMats.id_removeakt' => $Removeakt->removeakt_id])->all(); $startrow = $num; foreach ($MatbyParent as $ar) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, $num - $startrow + 1); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $num, $ar->idMattraffic->idMaterial->idMatv->matvid_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, $ar->idMattraffic->idMaterial->material_name); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(3, $num, $ar->idMattraffic->idMaterial->material_inv, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $num, $ar->idMattraffic->idMaterial->material_serial); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $num, $ar->idMattraffic->mattraffic_number); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $num, $ar->idMattraffic->idMaterial->idIzmer->izmer_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, Yii::$app->formatter->asDate($ar->idMattraffic->idMaterial->material_release, 'y')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $num, $ar->idMattraffic->idMaterial->material_price); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $num, $ar->idMattraffic->idMol->idperson->auth_user_fullname . ', ' . $ar->idMattraffic->idMol->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $num, $material_tip[$ar->idMattraffic->idMaterial->material_tip]); $num++; } if (count($MatbyParent) > 0) { $this->setStyle(self::$DATA, 'A' . $startrow . ':K' . ($num - 1)); } $this->CellsWrapAndTop('A' . $startrow . ':K' . $num); $num++; } } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, '(Подпись)'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $num, '(Должность)'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, '(Ф.И.О.)'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(3, $num, 6, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(7, $num, 10, $num); $this->setStyle(self::$SIGN, 'A' . $num . ':K' . $num); $num++; $Mols = Removeakt::getMolsByRemoveakt($Removeakt->removeakt_id); $startrow = $num; foreach ($Mols as $ar) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Материально ответственное лицо'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 1, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(3, $num, 6, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(7, $num, 10, $num); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $num, $ar->dolzh_name_tmp); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $ar->auth_user_fullname_tmp); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $objPHPExcel->getActiveSheet()->getRowDimension($num)->setRowHeight(45.75); $num++; } $this->setStyle(self::$TITLELEFT, 'A' . $startrow . ':B' . ($num - 1)); $this->setStyle(self::$SIGNDATA, 'C' . $startrow . ':K' . ($num - 1)); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Демонтажник'); $this->setStyle(self::$TITLELEFT, 'A' . $num . ':B' . $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 1, $num); $this->setStyle(self::$SIGNDATA, 'C' . $num . ':K' . $num); $Remover = Employee::findOne($Removeakt->id_remover); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(3, $num, 6, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(7, $num, 10, $num); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $num, $Remover->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $Remover->idperson->auth_user_fullname); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $objPHPExcel->getActiveSheet()->getRowDimension($num)->setRowHeight(45.75); }
protected function Body() { $ID = $this->getDopparamID(); $this->setReportName('Акт перемещения матер-ых цен-тей №' . $ID); $Installakt = Installakt::findOne($ID); $Trosnov = TrOsnov::findAll(['id_installakt' => $ID]); $Trmat = TrMat::find()->andWhere(['id_installakt' => $ID])->GroupBy('id_parent')->all(); $objPHPExcel = $this->getObjPHPExcel(); $objPHPExcel->getActiveSheet()->setCellValue('A3', 'материальных ценностей № ' . $Installakt->installakt_id . ' от ' . Yii::$app->formatter->asDate($Installakt->installakt_date)); $num = 5; $c_Trosnov = count($Trosnov); if ($c_Trosnov > 0) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Перемещение материальных ценностей'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLE, 'A' . $num . ':K' . $num); $num++; $this->SetTitlebyArray(['№', 'Вид', 'Наименование', 'Инвентарный номер', 'Серийный номер', 'Кол-во', 'Единица измерения', 'Лицо отправитель', 'Здание, кабинет, откуда перемещено', 'Лицо получатель', 'Здание, кабинет, куда перемещено'], $num); $this->setStyle(self::$CAPTION, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $this->setColumnNumbers($num, 11); $this->setStyle(self::$NUMS, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $startrow = $num; foreach ($Trosnov as $ar) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, $num - $startrow + 1); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $num, $ar->idMattraffic->idMaterial->idMatv->matvid_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, $ar->idMattraffic->idMaterial->material_name); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(3, $num, $ar->idMattraffic->idMaterial->material_inv, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $num, $ar->idMattraffic->idMaterial->material_serial); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $num, $ar->idMattraffic->mattraffic_number); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $num, $ar->idMattraffic->idMaterial->idIzmer->izmer_name); $mattraffic_previous = Mattraffic::GetPreviousMattrafficByInstallaktMaterial($ID, $ar->idMattraffic->id_material); if (!empty($mattraffic_previous)) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $mattraffic_previous->idMol->idperson->auth_user_fullname . ', ' . $mattraffic_previous->idMol->iddolzh->dolzh_name); if ($mattraffic_previous->mattraffic_tip == 1 && empty($mattraffic_previous->trOsnovs[0]->tr_osnov_kab)) { $kab = ', Приход'; } elseif ($mattraffic_previous->mattraffic_tip == 2 && empty($mattraffic_previous->trOsnovs[0]->tr_osnov_kab)) { $kab = ', Списание'; } else { $kab = ', ' . $mattraffic_previous->trOsnovs[0]->tr_osnov_kab; } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $num, $mattraffic_previous->idMol->idbuild->build_name . $kab); } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $num, $ar->idMattraffic->idMol->idperson->auth_user_fullname . ', ' . $ar->idMattraffic->idMol->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $num, $ar->idMattraffic->idMol->idbuild->build_name . ', ' . $ar->tr_osnov_kab); $num++; } if (count($Trosnov) > 0) { $this->setStyle(self::$DATA, 'A' . $startrow . ':K' . ($num - 1)); } $this->CellsWrapAndTop('A' . $startrow . ':K' . $num); $num++; } $c_Trmat = count($Trmat); if ($c_Trmat > 0) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Установка комплектующих'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLE, 'A' . $num . ':K' . $num); $num++; foreach ($Trmat as $arm) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Материальная ценность'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLELEFT, 'A' . $num . ':K' . $num); $num++; $this->SetTitlebyArray(['№', 'Вид', 'Наименование', 'Инвентарный номер', 'Серийный номер', 'Год выпуска', 'Стоимость', 'Здание', 'Кабинет', 'Материально-ответственное лицо', 'Тип'], $num); $this->setStyle(self::$CAPTION, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $this->setColumnNumbers($num, 11); $this->setStyle(self::$NUMS, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $material_tip = Material::VariablesValues('material_tip'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 1); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $num, $arm->idParent->idMaterial->idMatv->matvid_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, $arm->idParent->idMaterial->material_name); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(3, $num, $arm->idParent->idMaterial->material_inv, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $num, $arm->idParent->idMaterial->material_serial); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $num, Yii::$app->formatter->asDate($arm->idParent->idMaterial->material_release, 'y')); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(6, $num, $arm->idParent->idMaterial->material_price, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $arm->idParent->idMol->idbuild->build_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $num, $arm->idParent->trOsnovs[0]->tr_osnov_kab); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $num, $arm->idParent->idMol->idperson->auth_user_fullname . ', ' . $arm->idParent->idMol->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $num, $material_tip[$arm->idParent->idMaterial->material_tip]); $this->setStyle(self::$DATA, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Установленные комплектующие'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 10, $num); $this->setStyle(self::$TITLELEFT, 'A' . $num . ':K' . $num); $num++; $this->SetTitlebyArray(['№', 'Вид', 'Наименование', 'Инвентарный номер', 'Серийный номер', 'Кол-во', 'Единица измерения', 'Год выпуска', 'Стоимость', 'Материально-ответственное лицо', 'Тип'], $num); $this->setStyle(self::$CAPTION, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $this->setColumnNumbers($num, 11); $this->setStyle(self::$NUMS, 'A' . $num . ':K' . $num); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $num++; $MatbyParent = TrMat::find()->andWhere(['id_parent' => $arm->idParent->primaryKey, 'id_installakt' => $Installakt->installakt_id])->all(); $startrow = $num; foreach ($MatbyParent as $ar) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, $num - $startrow + 1); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $num, $ar->idMattraffic->idMaterial->idMatv->matvid_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, $ar->idMattraffic->idMaterial->material_name); $objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(3, $num, $ar->idMattraffic->idMaterial->material_inv, \PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $num, $ar->idMattraffic->idMaterial->material_serial); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $num, $ar->idMattraffic->mattraffic_number); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $num, $ar->idMattraffic->idMaterial->idIzmer->izmer_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, Yii::$app->formatter->asDate($ar->idMattraffic->idMaterial->material_release, 'y')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $num, $ar->idMattraffic->idMaterial->material_price); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $num, $ar->idMattraffic->idMol->idperson->auth_user_fullname . ', ' . $ar->idMattraffic->idMol->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $num, $material_tip[$ar->idMattraffic->idMaterial->material_tip]); $num++; } if (count($MatbyParent) > 0) { $this->setStyle(self::$DATA, 'A' . $startrow . ':K' . ($num - 1)); } $this->CellsWrapAndTop('A' . $startrow . ':K' . $num); $num++; } } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $num, '(Подпись)'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $num, '(Должность)'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, '(Ф.И.О.)'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(3, $num, 6, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(7, $num, 10, $num); $this->setStyle(self::$SIGN, 'A' . $num . ':K' . $num); $num++; $Mols = Installakt::getMolsByInstallakt($Installakt->installakt_id); $startrow = $num; foreach ($Mols as $ar) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Материально ответственное лицо'); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 1, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(3, $num, 6, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(7, $num, 10, $num); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $num, $ar->dolzh_name_tmp); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $ar->auth_user_fullname_tmp); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $objPHPExcel->getActiveSheet()->getRowDimension($num)->setRowHeight(45.75); $num++; } $this->setStyle(self::$TITLELEFT, 'A' . $startrow . ':B' . ($num - 1)); $this->setStyle(self::$SIGNDATA, 'C' . $startrow . ':K' . ($num - 1)); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $num, 'Мастер'); $this->setStyle(self::$TITLELEFT, 'A' . $num . ':B' . $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $num, 1, $num); $this->setStyle(self::$SIGNDATA, 'C' . $num . ':K' . $num); $Master = Employee::findOne($Installakt->id_installer); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(3, $num, 6, $num); $objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(7, $num, 10, $num); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $num, $Master->iddolzh->dolzh_name); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $num, $Master->idperson->auth_user_fullname); $this->CellsWrapAndTop('A' . $num . ':K' . $num); $objPHPExcel->getActiveSheet()->getRowDimension($num)->setRowHeight(45.75); }
public function searchformaterialcontain($params) { $query = TrMat::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['tr_mat_id' => SORT_DESC]]]); $query->joinWith(['idInstallakt', 'idMattraffic.idMaterial', 'idMattraffic.idMol.idperson', 'idMattraffic.idMol.iddolzh', 'idParent', 'trRmMats']); $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->andWhere('tr_mat_id not in (select tmo.id_tr_mat from tr_mat_osmotr tmo where tmo.id_osmotraktmat = ' . $params['idosmotraktmat'] . ')'); // grid filtering conditions $query->andFilterWhere(['tr_mat_id' => $this->tr_mat_id, 'id_mattraffic' => $this->id_mattraffic, 'id_parent' => $this->id_parent]); $query->andWhere(['trRmMats.id_tr_mat' => NULL]); $query->andWhere(['idParent.id_material' => $params['id']]); $query->andFilterWhere(Proc::WhereConstruct($this, 'id_installakt')); $query->andFilterWhere(Proc::WhereConstruct($this, 'idInstallakt.installakt_date'), 'date'); $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(Proc::WhereConstruct($this, 'idMattraffic.mattraffic_number')); $query->andFilterWhere(['LIKE', 'idperson.auth_user_fullname', $this->getAttribute('idMattraffic.idMol.idperson.auth_user_fullname')]); $query->andFilterWhere(['LIKE', 'iddolzh.dolzh_name', $this->getAttribute('idMattraffic.idMol.iddolzh.dolzh_name')]); $query->andFilterWhere(['LIKE', 'idbuild.build_name', $this->getAttribute('idMattraffic.idMol.idbuild.build_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idInstallakt.installakt_date', 'idMattraffic.idMaterial.material_name', 'idMattraffic.idMaterial.material_inv', 'idMattraffic.mattraffic_number', 'idMattraffic.idMol.idperson.auth_user_fullname', 'idMattraffic.idMol.iddolzh.dolzh_name', 'idMattraffic.idMol.idbuild.build_name']); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getTrMats() { return $this->hasMany(TrMat::className(), ['id_mattraffic' => 'mattraffic_id'])->from(['trMats' => TrMat::tableName()]); }
/** * @return \yii\db\ActiveQuery */ public function getTrMats() { return $this->hasMany(TrMat::className(), ['id_installakt' => 'installakt_id'])->from(['trMats' => TrMat::tableName()])->inverseOf('idInstallakt'); }
/** * Finds the TrMat model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return TrMat the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TrMat::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }