D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreSelecionarPedClinica.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit();} /** * Description of GreSelecionarPedClinica * * @copyright (c) year,Carlos Marques CM */ class GreSelecionarPedClinica{ 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(); }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 ped.gre_filial_id fili_id, ped.gre_status_fat_id stat_id, max(stat.nome) stat_nome FROM gre_pedido ped join gre_status_fat stat on stat.id = ped.gre_status_fat_id inner join gre_fornecedores forn on forn.id = ped.gre_fornecedor_id WHERE ped.gre_empr_princ_id =" . $_SESSION['id_user'] . " group by ped.gre_filial_id, ped.gre_status_fat_id order by ped.gre_status_fat_id"); $registro['stat'] = $listar->getResultado(); $listar->fullRead("SELECT ped.gre_filial_id fili_id, ped.gre_status_fat_id stat_id, forn.id forn_id, max(forn.nome_fantasia) forn_nome FROM gre_pedido ped inner join gre_fornecedores forn on forn.id = ped.gre_fornecedor_id WHERE ped.gre_empr_princ_id = ". $_SESSION['id_user'] . " group by ped.gre_status_fat_id, ped.gre_filial_id, forn.id order by ped.gre_filial_id, forn.nome_fantasia"); $registro['forn'] = $listar->getResultado(); $listar->fullRead("SELECT ped.gre_filial_id fili_id, ped.gre_status_fat_id stat_id, forn.id forn_id, ped.data, date_format(ped.data, '%d/%m/%Y') data_imp FROM gre_pedido ped inner join gre_fornecedores forn on forn.id = ped.gre_fornecedor_id WHERE ped.gre_empr_princ_id = 1 group by ped.gre_filial_id , forn.id, ped.data order by ped.data"); $registro['data'] = $listar->getResultado(); $this->Resultado = ['filial' => $registro['filial'], 'stat' => $registro['stat'], 'forn' => $registro['forn'], 'data' => $registro['data']]; return $this->Resultado; } }