public function actionImprimirFiltro() { //echo'<pre>';print_r($_GET);echo'</pre>'; exit; $fechaInicial = date("d-m-Y", strtotime($_GET['fechas']["filtro"]["fechaInicial"])); $fechaFinal = date("d-m-Y", strtotime($_GET['fechas']["filtro"]["fechaFinal"])); $formato = 'fechaCreacion >= "' . $fechaInicial . '" and fechaCreacion <= "' . $fechaFinal . '"'; $VisitasEmpresas = VisitasEmpresas::find()->where('fechaCreacion >= :fechaInicial and fechaCreacion <= :fechaFinal', ['fechaInicial' => $fechaInicial, 'fechaFinal' => $fechaFinal])->all(); $content = $this->renderPartial('_imprimir', ['VisitasEmpresas' => $VisitasEmpresas]); $header = $this->renderPartial('_header', ['VisitasEmpresas' => $VisitasEmpresas]); $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
/** * @return \yii\db\ActiveQuery */ public function getVisitasEmpresas() { return $this->hasMany(VisitasEmpresas::className(), ['empresa_did' => 'id']); }