コード例 #1
0
 /**
  * Finds the Removeakt model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Removeakt the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Removeakt::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
ファイル: RemoveaktSearch.php プロジェクト: vovancho/yii2test
 /**
  * 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;
 }
コード例 #3
0
ファイル: RemoveaktReport.php プロジェクト: vovancho/yii2test
 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);
 }
コード例 #4
0
ファイル: Employee.php プロジェクト: vovancho/yii2test
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRemoveakts()
 {
     return $this->hasMany(Removeakt::className(), ['id_remover' => 'employee_id'])->from(['removeakts' => Removeakt::tableName()]);
 }
コード例 #5
0
ファイル: TrRmMat.php プロジェクト: vovancho/yii2test
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdRemoveakt()
 {
     return $this->hasOne(Removeakt::className(), ['removeakt_id' => 'id_removeakt'])->from(['idRemoveakt' => Removeakt::tableName()]);
 }