/** * Pagina para filtrar campos y delver inform */ public function actionListado() { $model = new Cuenta(); if (Yii::$app->request->post('consulta') != NULL) { $this->layout = 'printlayout'; $pdf = new mPDF('utf-8', 'A4-L', 0, '', 10, 10, 10, 10); $movimientos = $model->getListado(Yii::$app->request->post('consulta')); $movPerPage = 25; $misMovimientos = array_chunk($movimientos, $movPerPage, true); $numPages = count($misMovimientos); $anyoActual = Cuenta::getDb()->createCommand('SELECT contActual()')->queryScalar(); foreach ($misMovimientos as $key => $valor) { $ultimo = false; if ($key + 1 == $numPages) { $ultimo = true; } $content = $this->render('imprimir', ['model' => $model, 'movimientos' => $valor, 'mpdf' => $pdf, 'ultimo' => $ultimo, 'anyoactual' => $anyoActual]); //$pdf->SetHeader('Movimientos del año 2015'); $pdf->SetHTMLHeader($this::$CABECERA, '', true); $pdf->SetFooter('Página ' . ($key + 1) . ' de ' . $numPages . '->' . '{PAGENO}'); $pdf->WriteHTML($content); if (!$ultimo) { $pdf->AddPage(); } } $pdf->Output(); exit; /****************************************************************************************/ } /**Pagina de filtrado************************/ return $this->render('listado', ['model' => $model, 'tipos' => $model->getTipos()]); }