D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreListarAvaliacao.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GrsListarContr * * @copyright (c) year, Carlos Marques - CM */ class GreListarAvaliacao { private $Dados; private $Resultado; public function listarAval($PageId = null, $Dados = null) { $this->PageId = (int) $PageId; $this->Dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); // var_dump($this->Dados); if(isset($this->Dados['gre_filial_id'])) { $this->Dados['gre_filial_id'] = trim($this->Dados['gre_filial_id']); if(!empty($this->Dados['gre_filial_id'])){ $this->pesquisarFiliCod(); return $this->Resultado; }else{ $this->listarCadastrar(); } } } private function pesquisarFiliCod() { $listarAval = new \App\adms\Models\helper\AdmsRead(); $listarAval->fullRead("SELECT resid.id, resid.nome resid_nome, mask(lpad(resid.cpf,11,0), '###.###.###-##') cpf, filial.id filial_id, sit.nome nome_sit, cr.cor cor_cr FROM gre_residente resid inner join gre_filial filial on filial.id = resid.gre_filial_id inner join gre_empresa empr on empr.id = filial.gre_empr_princ_id INNER JOIN adms_sits sit ON sit.id= resid.adms_sit_id INNER JOIN adms_cors cr ON cr.id=sit.adms_cor_id where resid.adms_sit_id in (1,3) and empr.id = :empr_id and resid.gre_filial_id = :filial_id and resid.id not in (select a.gre_residente_id from gre_acolhimento a where a.gre_filial_id = :filial_id) ORDER BY filial.id, resid.nome asc", "filial_id={$this->Dados['gre_filial_id']}&empr_id={$_SESSION['id_user']}"); $this->Resultado = $listarAval->getResultado(); // var_dump( $this->Resultado); return $this->Resultado; } public function listarCadastrar() { $listar = new \App\adms\Models\helper\AdmsRead(); if( $_SESSION['filial']==0){ $listar->fullRead("SELECT filial.id id_filial, filial.nome_fantasia nome_filial FROM gre_filial filial where filial.gre_empr_princ_id =". $_SESSION['id_user'] . " ORDER BY filial.id"); }else{ $listar->fullRead("SELECT filial.id id_filial, filial.nome_fantasia nome_filial FROM gre_filial filial where filial.gre_empr_princ_id =". $_SESSION['id_user'] . " AND filial.id = ". $_SESSION['filial']); } $registro['filial'] = $listar->getResultado(); $this->Resultado = ['filial' => $registro['filial']]; return $this->Resultado; } }