Exemplo n.º 1
0
 public function actionPromissoria2($id, $idvenda)
 {
     //Criação de objetos para a geração do relatório
     $model = Cliente::findOne($id);
     $model2 = Venda::findOne($idvenda);
     //Adicionado Promissoria
     $searchModel2 = new VendaSearch();
     $searchModel2->cliente_idcliente = $id;
     $dataProvider2 = $searchModel2->search(Yii::$app->request->queryParams);
     $content = $this->renderPartial('promissoria', ['model' => $model, 'model2' => $model2, 'dataProvider2' => $dataProvider2]);
     $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' => 'SGO - Nota Promissória - Cliente'], 'methods' => ['SetHeader' => ['SGO - Nota Promissória - Cliente'], 'SetFooter' => ['{PAGENO}']]]);
     return $pdf->render();
 }
Exemplo n.º 2
0
 /**
  * Finds the Venda model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Venda the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Venda::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }