D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreSelecionarCliniListInventario.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit();} /** * Description of GreSelecionarCliniListInventario * * @copyright (c) year,Carlos Marques CM */ class GreSelecionarCliniListInventario{ private $Resultado; private $Dados; private $ResidId; private $idResidLanc; private $idUser; private $UltimoResidLanc; private $substituicao = array( ' ' => '', '_' => '', '-' => '', '/' => '', '.' => '', ',' => '.', '(' => '', ')' => ''); function getResultado() { return $this->Resultado; } public function listarCadastrar() { $listar = new \App\adms\Models\helper\AdmsRead(); if($_SESSION['filial']==0){ $listar->fullRead(" Select depto.id depto_id, max(est.gre_filial_id) filial_id, max(depto.nome) depto_nome FROM gre_estoque_clinica est join gre_produto prod on est.gre_produto_id = prod.id join gre_prod_departamento depto on prod.gre_departamento_id = depto.id where est.gre_empr_princ_id= " . $_SESSION['id_user'] . " group by depto.id order by depto.nome"); $registro['depto'] = $listar->getResultado(); $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(); }else{ $listar->fullRead(" depto.id, est.gre_filial_id filial_id, max(depto.nome) depto_nome FROM gre_estoque_clinica est join gre_produto prod on est.gre_produto_id = prod.id join gre_prod_departamento depto on prod.gre_departamento_id = depto.id where est.gre_empr_princ_id= " . $_SESSION['id_user'] . " and est.gre_filial_id = " .$_SESSION['filial'] . " group by depto.id, est.gre_filial_id order by depto.nome"); $registro['depto'] = $listar->getResultado(); $listar->fullRead("SELECT filial.id filial_id, filial.nome_fantasia filial_nome FROM gre_filial filial where est.gre_empr_princ_id= " . $_SESSION['id_user'] . " and est.gre_filial_id = " .$_SESSION['filial'] ); $registro['filial'] = $listar->getResultado(); } $this->Resultado = [ 'depto' => $registro['depto'], 'filial' => $registro['filial']]; return $this->Resultado; } }