Beispiel #1
0
 /**
  * Finds the Cliente model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $nome
  * @param string $tel
  * @return Cliente the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($nome, $tel)
 {
     if (($model = Cliente::findOne(['nome' => $nome, 'tel' => $tel])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Finds the Cliente model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Cliente the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Cliente::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 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();
 }
Beispiel #4
0
 public function actionListarRemoto($search = null, $id = null)
 {
     $out = ['more' => false];
     if (!is_null($search)) {
         $query = new Query();
         $query->select(['idcliente AS id', 'CONCAT(nome, " - ", cpf) AS text'])->from('cliente')->where('nome LIKE "%' . $search . '%"')->limit(200);
         //$query -> select('idcliente AS id, nome AS text')->from('cliente')->where('nome LIKE "%'.$search.'%"')->limit(200);
         $command = $query->createCommand();
         $data = $command->queryAll();
         $out['results'] = array_values($data);
     } elseif ($id > 0) {
         $out['results'] = ['id' => $id, 'text' => Cliente::findOne($id)->nome];
     } else {
         $out['results'] = ['id' => 0, 'text' => 'No matching records found'];
     }
     echo Json::encode($out);
 }