public function actionIndex() { $var_ispyt_3 = []; foreach (AttestacionnoeVariativnoeIspytanie_3::find()->orderBy('nazvanie')->each() as $item) { $var_ispyt_3['var' . $item->id] = $item['nazvanie']; } $postoyannye = []; foreach (PostoyannoeIspytanie::find()->orderBy('nazvanie')->each() as $item) { $postoyannye['pos' . $item->id] = $item->nazvanie; } $ispytaniyaList = ['Постоянные испытания' => $postoyannye, 'Третье вариативное испытание' => $var_ispyt_3]; return $this->render('index', compact('ispytaniyaList')); }
public function actionOtchetByRajon() { if (isset($_GET['vp']) and $vremya_provedeniya = $_GET['vp']) { $ispytaniya = AttestacionnoeVariativnoeIspytanie_3::find()->orderBy('nazvanie')->all(); $sql = "SELECT\n t.rajon_id,\n t.rajon,\n EXTRACT(YEAR from t.nachalo) as year,\n EXTRACT(month from t.nachalo) as month,\n SUM(CASE WHEN t.na_kategoriyu = 'pervaya_kategoriya' and t.count_bally_below_min = 0 THEN 1 ELSE 0 end) as pervaya_reccomended,\n SUM(CASE WHEN t.na_kategoriyu = 'pervaya_kategoriya' and t.count_bally_below_min > 0 THEN 1 ELSE 0 end) as pervaya_notreccomended,\n SUM(CASE WHEN t.na_kategoriyu = 'vyshaya_kategoriya' and t.count_bally_below_min = 0 THEN 1 ELSE 0 end) as vyshaya_reccomended,\n SUM(CASE WHEN t.na_kategoriyu = 'vyshaya_kategoriya' and t.count_bally_below_min > 0 THEN 1 ELSE 0 end) as vyshaya_notreccomended,\n count(*) as all_zayavleniya\n FROM\n (\n SELECT\n z.id as zayavlenie_id,\n count_bally_below_min(z.id),\n vpa.nachalo, z.na_kategoriyu,\n coalesce(ao.formalnoe_nazvanie, 'не задано') as rajon,\n COALESCE(ao.id, -1) as rajon_id\n FROM zayavlenie_na_attestaciyu AS z\n INNER JOIN organizaciya as o on z.rabota_organizaciya = o.id\n left JOIN adresnyj_objekt as ao on o.adres_adresnyj_objekt = ao.id\n INNER JOIN vremya_provedeniya_attestacii as vpa on z.vremya_provedeniya = vpa.id\n WHERE z.status = 'podpisano_otdelom_attestacii' AND z.vremya_provedeniya = :vp\n ) AS t\n GROUP BY t.nachalo, t.rajon, t.rajon_id\n ORDER BY t.rajon"; $data = \Yii::$app->db->createCommand($sql)->bindValue(':vp', $vremya_provedeniya)->queryAll(); $report = []; foreach ($data as $item) { $report[$item['rajon_id']] = $item; } $vremya = VremyaProvedeniyaAttestacii::findOne($vremya_provedeniya); $content = $this->renderPartial('rajon', compact('vremya', 'report', 'ispytaniya')); $pdf = new Pdf($this->getPdfSeetings($content)); // return the pdf output as per the destination setting return $pdf->render(); } else { return $this->render('rajon-form'); } }
public function actionOtsenki() { \Yii::$app->response->format = Response::FORMAT_JSON; $response = new JsResponse(); $error = ''; $fizLico = ApiGlobals::getFizLicoPolzovatelyaId(); $zayavlenieId = $_REQUEST['zayavlenie_id']; $ajax = $_REQUEST['ajax']; $rabotnik = RabotnikAttestacionnojKomissii::find()->where(['fiz_lico' => $fizLico])->one(); /** * @var ZayavlenieNaAttestaciyu $zayavlenie */ $zayavlenie = ZayavlenieNaAttestaciyu::find()->joinWith('portfolioFajlRel')->joinWith('varIspytanie3FajlRel')->joinWith('prezentatsiyaFajlRel')->joinWith('otraslevoeSoglashenieZayavleniyaRel')->where(['zayavlenie_na_attestaciyu.id' => $zayavlenieId])->one(); $raspredelenie = RaspredelenieZayavlenijNaAttestaciyu::find()->joinWith('rabotnikAttestacionnojKomissiiRel')->where(['rabotnik_attestacionnoj_komissii.fiz_lico' => $fizLico])->andWhere(['zayavlenie_na_attestaciyu' => $zayavlenieId])->exists(); $r = RaspredelenieZayavlenijNaAttestaciyu::find()->joinWith('rabotnikAttestacionnojKomissiiRel')->where(['rabotnik_attestacionnoj_komissii.fiz_lico' => $fizLico])->andWhere(['zayavlenie_na_attestaciyu' => $zayavlenieId])->all(); $first = function ($array) { if (count($array) > 0) { return $array[0]; } else { return false; } }; if ($raspredelenie) { $transaction = \Yii::$app->db->beginTransaction(); try { $postoyannieIspyetaniya = [PostoyannoeIspytanie::getPortfolioId()]; $variativnoeIspytanie = []; if ($zayavlenie->na_kategoriyu == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA) { if (count($zayavlenie->otraslevoeSoglashenieZayavleniyaRel) == 0) { $variativnoeIspytanie[] = $zayavlenie->var_ispytanie_3; $postoyannieIspyetaniya[] = PostoyannoeIspytanie::getSpdId(); } } $otsenochnieListy = OtsenochnyjList::find()->joinWith('ispytanieOtsenochnogoListaRel')->where(['in', 'ispytanie_otsenochnogo_lista.postoyannoe_ispytanie', $postoyannieIspyetaniya])->orWhere(['in', 'ispytanie_otsenochnogo_lista.var_ispytanie_3', $variativnoeIspytanie])->all(); foreach ($otsenochnieListy as $list) { /** * @var OtsenochnyjList $list */ if (!OtsenochnyjListZayavleniya::find()->where(['otsenochnij_list' => $list->id])->andWhere(['rabotnik_komissii' => $fizLico])->andWhere(['zayavlenie_na_attestaciyu' => $zayavlenieId])->exists()) { $new_ol_zayvaleniya = new OtsenochnyjListZayavleniya(); $new_ol_zayvaleniya->otsenochnijList = $list->id; $new_ol_zayvaleniya->rabotnikKomissii = $fizLico; $new_ol_zayvaleniya->zayavlenieNaAttestaciyu = $zayavlenieId; $ispytanie = $first($list->ispytanieOtsenochnogoListaRel); if ($ispytanie && $ispytanie->postoyannoeIspytanie) { $new_ol_zayvaleniya->postoyannoeIspytanie = $ispytanie->postoyannoeIspytanie; } if ($ispytanie && $ispytanie->var_ispytanie_3) { $new_ol_zayvaleniya->var_ispytanie_3 = $ispytanie->var_ispytanie_3; } $new_ol_zayvaleniya->nazvanie = $list->nazvanie; $new_ol_zayvaleniya->minBallPervayaKategoriya = $list->minBallPervayaKategoriya; $new_ol_zayvaleniya->minBallVisshayaKategoriya = $list->minBallVisshayaKategoriya; $new_ol_zayvaleniya->save(); $sql = ' INSERT INTO struktura_otsenochnogo_lista_zayvaleniya (otsenochnyj_list_zayavleniya,nazvanie,max_bally, nomer, uroven, struktura_otsenochnogo_lista, roditel) select :ol, sol.nazvanie, sol.bally, case when sol.roditel is not null then sol_roditel.nomer||\'.\'||sol.nomer else cast(sol.nomer as varchar) end as nomer, case when sol.roditel is not null then 2 else 1 end as uroven, sol.id, sol.roditel from otsenochnyj_list as ol inner join struktura_otsenochnogo_lista as sol on ol.id = sol.otsenochnyj_list left join struktura_otsenochnogo_lista as sol_roditel on sol.roditel = sol_roditel.id inner join ispytanie_otsenochnogo_lista as iol on ol.id = iol.otsenochnyj_list where ol.id = ' . $list->id . ' and ' . ($ispytanie->var_ispytanie_3 ? 'iol.var_ispytanie_3=:isp' : 'iol.postoyannoe_ispytanie=:isp') . ' order by nomer '; \Yii::$app->db->createCommand($sql)->bindValue(':ol', $new_ol_zayvaleniya->id)->bindValue(':isp', $ispytanie->var_ispytanie_3 ? $ispytanie->var_ispytanie_3 : $ispytanie->postoyannoeIspytanie)->execute(); } } $transaction->commit(); } catch (Exception $e) { $transaction->rollBack(); $error = 'Оценочный лист не сформирован' . $e->getMessage(); } } else { $error = 'Недоступное действие для данного пользователя'; } $listy = OtsenochnyjListZayavleniya::find()->joinWith(['strukturaOtsenochnogoListaZayvaleniyaRel' => function ($query) { /** * @var ActiveQuery $query */ $query->orderBy(new Expression('cast(struktura_otsenochnogo_lista_zayvaleniya.nomer as FLOAT)')); }])->where(['otsenochnyj_list_zayavleniya.rabotnik_komissii' => $fizLico])->andWhere(['otsenochnyj_list_zayavleniya.zayavlenie_na_attestaciyu' => $zayavlenieId])->orderBy(new Expression('otsenochnyj_list_zayavleniya.id'))->all(); $result = []; foreach ($listy as $list) { /** * @var OtsenochnyjListZayavleniya $list */ if ($list->postoyannoeIspytanie == PostoyannoeIspytanie::getPortfolioId()) { //$result[] =$list->status; $portfolio = PostoyannoeIspytanie::find()->where(['id' => PostoyannoeIspytanie::getPortfolioId()])->one(); $result[] = new \app\models\sotrudnik_att_komissii\OtsenochnyjList(['ispytanie_name' => $portfolio->nazvanie, 'file_name' => $zayavlenie->portfolioFajlRel ? $zayavlenie->portfolioFajlRel->vneshnee_imya_fajla : '', 'file_link' => $zayavlenie->portfolioFajlRel ? $zayavlenie->portfolioFajlRel->getUri() : '', 'list' => $list, 'struktura' => $list->strukturaOtsenochnogoListaZayvaleniyaRel]); } else { if ($list->postoyannoeIspytanie == PostoyannoeIspytanie::getSpdId()) { //$result[] =$list->status; $spd = PostoyannoeIspytanie::find()->where(['id' => PostoyannoeIspytanie::getSpdId()])->one(); $result[] = new \app\models\sotrudnik_att_komissii\OtsenochnyjList(['ispytanie_name' => $spd->nazvanie, 'file_name' => $zayavlenie->prezentatsiyaFajlRel ? $zayavlenie->prezentatsiyaFajlRel->vneshnee_imya_fajla : '', 'file_link' => $zayavlenie->prezentatsiyaFajlRel ? $zayavlenie->prezentatsiyaFajlRel->getUri() : '', 'list' => $list, 'struktura' => $list->strukturaOtsenochnogoListaZayvaleniyaRel]); } else { if ($list->varIspytanie_3) { //$result[] =$list->status; $varIspytanie3 = AttestacionnoeVariativnoeIspytanie_3::find()->where(['id' => $list->varIspytanie_3])->one(); $result[] = new \app\models\sotrudnik_att_komissii\OtsenochnyjList(['ispytanie_name' => $varIspytanie3->nazvanie, 'file_name' => $zayavlenie->varIspytanie3FajlRel ? $zayavlenie->varIspytanie3FajlRel->vneshnee_imya_fajla : '', 'file_link' => $zayavlenie->varIspytanie3FajlRel ? $zayavlenie->varIspytanie3FajlRel->getUri() : '', 'list' => $list, 'struktura' => $list->strukturaOtsenochnogoListaZayvaleniyaRel]); } } } } if ($error) { $response->type = JsResponse::ERROR; $response->msg = $error; } else { $response->data = $result; } return $response; }
public function getAttestacionnoeVariativnoeIspytanie3Rel() { return $this->hasOne(AttestacionnoeVariativnoeIspytanie_3::className(), ['id' => 'var_ispytanie_3'])->inverseOf('zayavlenieNaAttestaciyuRel'); }
echo '</div>'; echo '<div id="data_okonchaniya_attestacii" class="col-md-3 no-right-padding">'; echo $form->field($registraciya, 'attestaciyaDataOkonchaniyaDejstviya')->widget(\kartik\widgets\DatePicker::className(), ['pluginOptions' => ['format' => 'dd.mm.yyyy']]); echo '</div>'; echo '</div> </div>'; echo $form->field($registraciya, 'kategoriya')->dropDownList(KategoriyaPedRabotnika::namesOnlyPositive(), ['placeholder' => 'Выберите категорию', 'onchange' => 'onChangeKategoriya(\'' . Html::getInputId($registraciya, 'kategoriya') . '\')', 'id' => 'registraciya-kategoriya']); //echo '<div id="varIspytanie2Div">'; //echo $form->field($registraciya,'varIspytanie2')->dropDownList( // \app\entities\AttestacionnoeVariativnoeIspytanie_2::find() // ->formattedAll(EntityQuery::DROP_DOWN,'nazvanie') //); //echo '</div>'; //echo count($registraciya->otraslevoeSoglashenie); echo '<div id="varIspytanie3Div" class="' . ((count($registraciya->otraslevoeSoglashenie) > 0 and $registraciya->kategoriya == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA) ? 'hidden' : '') . '">'; echo $form->field($registraciya, 'varIspytanie3')->dropDownList(\app\entities\AttestacionnoeVariativnoeIspytanie_3::find()->formattedAll(EntityQuery::DROP_DOWN, 'nazvanie'), ['disabled' => count($registraciya->otraslevoeSoglashenie) > 0 ? 'disabled' : false]); echo '</div>'; ?> <div id="panel-otraslevoe-soglashenie" class="panel panel-default"> <div class="panel-heading"> <b>Отраслевое соглашение</b> </div> <div class="panel-body"> <button type="button" class="btn btn-primary" onclick="addOtraslevoeSoglashenie()">Добавить достижение</button> <p></p> <div id="otraslevoeSoglashenieCntr"> <?php $k = 0; foreach ($registraciya->otraslevoeSoglashenie as $k => $osModel) {