D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreSelecionarEstoqueResidente.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit();} /** * Description of GreSelecionarEstoqueResidente * * @copyright (c) year,Carlos Marques CM */ class GreSelecionarEstoqueResidente{ private $Resultado; private $Dados; function getResultado() { return $this->Resultado; } public function listarCadastrar() { $listar = new \App\adms\Models\helper\AdmsRead(); if($_SESSION['filial']== 0) { $listar->fullRead("SELECT filial.id filial_id, filial.nome_fantasia filial_nome FROM gre_filial filial where filial.gre_empr_princ_id = " . $_SESSION['id_user']); $registro['filial'] = $listar->getResultado(); $listar->fullRead("SELECT resid.gre_filial_id,resid.id resid_id, resid.nome resid_nome FROM gre_residente resid inner join gre_estoque_residente est on est.gre_residente_id = resid.id where resid.gre_empr_princ_id = " . $_SESSION['id_user']. " group by resid.gre_filial_id, resid.id, resid.nome order by resid.gre_filial_id, resid.nome"); $registro['resid'] = $listar->getResultado(); }else{ $listar->fullRead("SELECT filial.id filial_id, filial.nome_fantasia filial_nome FROM gre_filial filial where filial.gre_empr_princ_id = " . $_SESSION['id_user'] . " AND filial.id = " . $_SESSION['filial']); $registro['filial'] = $listar->getResultado(); $listar->fullRead("SELECT max(resid.gre_filial_id) gre_filial_id,resid.id resid_id, max(resid.nome) resid_nome FROM gre_residente resid inner join gre_estoque_residente est on est.gre_residente_id = resid.id where resid.gre_empr_princ_id = " . $_SESSION['id_user'] . " AND filial.id = " . $_SESSION['filial']. " group by resid.id order by resid.gre_filial_id, resid.nome"); $registro['resid'] = $listar->getResultado(); } $this->Resultado = ['filial' => $registro['filial'], 'resid' => $registro['resid']]; return $this->Resultado; } }