Exemple #1
6
    public function actionItogovyj()
    {
        if (isset($_GET['vp']) and $vremya_provedeniya = $_GET['vp'] and isset($_GET['d']) and $dolzhnost = $_GET['d']) {
            $data = \Yii::$app->db->createCommand('select *
                             from attestaciya_itogovij_otchet(:vp,:d)
                             order by  case when otraslevoe_soglashenie is null then 0 else 1 end desc,
                              na_kategoriyu DESC,
                              imeushayasya_kategoriya DESC,
                              attestaciya_data_prisvoeniya DESC,
                              fio')->bindValue(':vp', $vremya_provedeniya)->bindValue(':d', $dolzhnost)->queryAll();
            $groups = ['otraslevoe_soglashenie' => []];
            foreach ($data as $item) {
                if ($item['na_kategoriyu'] == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA and $item['otraslevoe_soglashenie']) {
                    $groups['otraslevoe_soglashenie'][] = $item;
                } else {
                    $groups[$item['na_kategoriyu']][] = $item;
                }
            }
            $data = $groups;
            $content = $this->renderPartial('itogovyj-report', compact('data'));
            $indent = 3;
            $css = '
                body{
                   font-family:"Times New Roman","serif";
                }
                .paragraph{
                    text-align:justify;
                    margin-bottom: 5px;
                    margin-top: 5px;
                }
                .center{
                 text-align:center;
                }
                .tb {border-collapse: collapse}
                .tb td {padding: 5px;border: 1px solid #000}
                .inline-block{
                    display: inline-block;
                }
                .indent{padding-left: ' . $indent . 'em}

                .double-indent{padding-left: ' . 2 * $indent . 'em}

                .indent-block{
                    margin-left: ' . $indent . 'em;
                }
                .bold{
                    font-weight: bold;
                }
                ';
            $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_LANDSCAPE, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => $css, 'options' => ['title' => 'Отчет для к заседанию комиссии'], 'methods' => ['SetFooter' => ['']]]);
            // return the pdf output as per the destination setting
            return $pdf->render();
        } else {
            $dolzhnosti = Dolzhnost::getDolzhnostiAttestacii();
            return $this->render('itogovyj', compact('dolzhnosti'));
        }
    }
Exemple #2
0
 public function actionVarIsp()
 {
     if (isset($_GET['vp']) and $vremya_provedeniya = $_GET['vp']) {
         $ispytaniya = AttestacionnoeVariativnoeIspytanie_3::find()->orderBy('nazvanie')->all();
         $sql = "SELECT\n                  t.var_ispytanie_3, t.dolzhnost_id, t.dolzhnost_nazvanie,\n                  SUM(CASE WHEN t.count_bally_below_min = 0 THEN 1 ELSE 0 end) as reccomended,\n                  SUM(CASE WHEN t.count_bally_below_min > 0 THEN 1 ELSE 0 end) as notreccomended\n                FROM\n                (\n                  SELECT\n                    z.id as zayavlenie_id, z.var_ispytanie_3, d.id as dolzhnost_id, d.nazvanie as dolzhnost_nazvanie,\n                    count_bally_below_min(z.id)\n                  FROM zayavlenie_na_attestaciyu AS z\n                    INNER JOIN dolzhnost AS d ON z.rabota_dolzhnost = d.id\n                  WHERE z.status = 'podpisano_otdelom_attestacii' AND z.vremya_provedeniya = :vp AND z.var_ispytanie_3 IS NOT NULL\n                ) AS t\n                GROUP BY t.var_ispytanie_3, t.dolzhnost_id, t.dolzhnost_nazvanie\n                ORDER BY t.dolzhnost_nazvanie";
         $data = \Yii::$app->db->createCommand($sql)->bindValue(':vp', $vremya_provedeniya)->queryAll();
         $report = [];
         foreach ($data as $item) {
             if (!isset($report[$item['dolzhnost_id']])) {
                 $report[$item['dolzhnost_id']] = ['dolzhnost_nazvanie' => $item['dolzhnost_nazvanie'], 'var_isp' => []];
             }
             $report[$item['dolzhnost_id']]['var_isp'][$item['var_ispytanie_3']] = ['reccomended' => $item['reccomended'], 'notreccomended' => $item['notreccomended']];
         }
         $vremya = VremyaProvedeniyaAttestacii::findOne($vremya_provedeniya);
         $content = $this->renderPartial('var-isp.php', compact('vremya', 'report', 'ispytaniya'));
         $pdf = new Pdf($this->getPdfSeetings($content));
         // return the pdf output as per the destination setting
         return $pdf->render();
     } else {
         $dolzhnosti = Dolzhnost::getDolzhnostiAttestacii();
         return $this->render('var-isp-form.php');
     }
 }