D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreListarResidListProdLanc.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreListarResidListProdLanc * * @copyright (c) year, Carlos Marques - CM */ class GreListarResidListProdLanc { private $Resultado; private $PageId; private $LimiteResultado = 40; private $ResultadoPg; private $forn; function getResultadoPg() { return $this->ResultadoPg; } public function listResidListProdLanc($PageId = null, $Dados = null) { $this->Dados = filter_input_array(INPUT_GET, FILTER_DEFAULT); $listResidListEstLanc = new \App\adms\Models\helper\AdmsRead(); if( $this->Dados['data_final']=='') { $this->Dados['data_final'] = '9999-12-31'; } // var_dump($this->Dados); if( $this->Dados['tipolanc']=='T') { $listResidListEstLanc->fullRead("select est.mov_fin, case when est.fornecimento = 'C' then 'Clinica' else 'Familia' end forn_nome, :data_inicial data_inicial, :data_final data_final, :tipolanc tipolanc, resid.nome resid_nome, resid.id resid_id, est.id, date_format(est.data, '%d/%m/%Y %h:%m') data, est.descricao, prod.nome prod_nome, est.qtde, est.valor_total, usu.nome usuario_nome from gre_est_mov_residente est inner join gre_residente resid on resid.id = est.gre_residente_id inner join gre_produto prod on prod.id = est.gre_produto_id inner join adms_usuarios usu on usu.id = est.gre_usuario_id where est.gre_status_id = 1 and est.fornecimento = :forn and est.gre_residente_id = :resid_id and est.gre_empr_princ_id = :empr_id and date_format(est.data, '%Y-%m-%d') >= :data_inicial and date_format(est.data, '%Y-%m-%d') <= :data_final order by est.data ASC ", "resid_id={$this->Dados['id']}&empr_id={$_SESSION['id_user']}&forn={$this->Dados['forn']}&data_inicial={$this->Dados['data_inicial']}&data_final={$this->Dados['data_final']}&tipolanc={$this->Dados['tipolanc']}"); } $this->Resultado = $listResidListEstLanc->getResultado(); if( $this->Dados['tipolanc']=='A') { $listResidListEstLanc->fullRead("select est.mov_fin, case when est.fornecimento = 'C' then 'Clinica' else 'Familia' end forn_nome, :data_inicial data_inicial, :data_final data_final, :tipolanc tipolanc, resid.nome resid_nome, resid.id resid_id, est.id, date_format(est.data, '%d/%m/%Y %h:%m') data, est.descricao, prod.nome prod_nome, est.qtde, est.valor_total, usu.nome usuario_nome from gre_est_mov_residente est inner join gre_residente resid on resid.id = est.gre_residente_id inner join gre_produto prod on prod.id = est.gre_produto_id inner join adms_usuarios usu on usu.id = est.gre_usuario_id where est.gre_status_id = 1 and est.fornecimento = :forn and est.gre_residente_id = :resid_id and est.gre_empr_princ_id = :empr_id and date_format(est.data, '%Y-%m-%d') >= :data_inicial and date_format(est.data, '%Y-%m-%d') <= :data_final and lanca_duplo = 'A' order by est.data ASC ", "resid_id={$this->Dados['id']}&empr_id={$_SESSION['id_user']}&forn={$this->Dados['forn']}&data_inicial={$this->Dados['data_inicial']}&data_final={$this->Dados['data_final']}&tipolanc={$this->Dados['tipolanc']}"); } if( $this->Dados['tipolanc']=='M') { $listResidListEstLanc->fullRead("select est.mov_fin, case when est.fornecimento = 'C' then 'Clinica' else 'Familia' end forn_nome, :data_inicial data_inicial, :data_final data_final, :tipolanc tipolanc, resid.nome resid_nome, resid.id resid_id, est.id, date_format(est.data, '%d/%m/%Y %h:%m') data, est.descricao, prod.nome prod_nome, est.qtde, est.valor_total, usu.nome usuario_nome from gre_est_mov_residente est inner join gre_residente resid on resid.id = est.gre_residente_id inner join gre_produto prod on prod.id = est.gre_produto_id inner join adms_usuarios usu on usu.id = est.gre_usuario_id where est.gre_status_id = 1 and est.fornecimento = :forn and est.gre_residente_id = :resid_id and date_format(est.data, '%Y-%m-%d') >= :data_inicial and date_format(est.data, '%Y-%m-%d') <= :data_final and lanca_duplo <> 'A' order by est.data ASC ", "resid_id={$this->Dados['id']}&forn={$this->Dados['forn']}&data_inicial={$this->Dados['data_inicial']}&data_final={$this->Dados['data_final']}&tipolanc={$this->Dados['tipolanc']}"); } $this->Resultado = $listResidListEstLanc->getResultado(); //var_dump($this->Resultado); return $this->Resultado; } }