D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreCadastrarIntercorrencia.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit();} /** * Description of GreCadastrarIntercorrencia * * @copyright (c) year,Carlos Marques CM */ class GreCadastrarIntercorrencia { private $Resultado; private $Dados; private $ResidId; private $idResidLanc; private $idUser; function getResultado() { return $this->Resultado; } public function cadIntercor(array $Dados) { $this->Dados = $Dados; date_default_timezone_set ("America/Sao_Paulo"); $this->Dados['created'] = date("Y-m-d H:i:s"); $this->Dados['gre_usuario_id'] = $_SESSION['usuario_id']; if($this->Dados['exige_autorizacao']=='S'){ $this->Dados['adms_sit_id'] = 1; $this->Dados['chave_autorizacao'] = md5($this->Dados['gre_residente_id'] . date('Y-m-d H:i:s')); }else{ $this->Dados['adms_sit_id'] = 2; } $this->Dados['gre_empr_princ_id'] = $_SESSION['id_user']; //var_dump($this->Dados ); // die; $cadIntercor = new \App\adms\Models\helper\AdmsCreate; $cadIntercor->exeCreate("gre_intercorrencia", $this->Dados); if ($cadIntercor->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Intercorrência cadastrada com sucesso! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Intercorrência não foi cadastrada! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } public function listarCadastrar() { $this->ResidId = filter_input(INPUT_GET, 'id'); $listar = new \App\adms\Models\helper\AdmsRead(); $this->idUser = $_SESSION['id_user']; $listar->fullRead("SELECT empr.id id_empr FROM gre_empresa empr where empr.id= ". $this->idUser); $registro['empr'] = $listar->getResultado(); if($_SESSION['filial']==0){ $listar->fullRead("SELECT resid.id id_resid, resid.nome resid_nome, resid.gre_filial_id resid_gre_filial_id, resid.gre_contratante_id contr_id FROM gre_residente resid where resid.id = ".$this->ResidId. " and resid.gre_empr_princ_id=". $_SESSION['id_user']); $registro['resid'] = $listar->getResultado(); }else{ $listar->fullRead("SELECT resid.id id_resid, resid.nome resid_nome, resid.gre_filial_id resid_gre_filial_id, resid.gre_contratante_id contr_id FROM gre_residente resid where resid.gre_empr_princ_id=". $_SESSION['id_user']. " AND resid.gre_filial_id = ". $_SESSION['filial']); $registro['resid'] = $listar->getResultado(); } $listar->fullRead("SELECT tipointercor.id tipo_id, tipointercor.nome tipo_nome FROM gre_tipo_intercorrencia tipointercor order by tipointercor.ordem"); $registro['tipo'] = $listar->getResultado(); $this->Resultado = ['empr' => $registro['empr'], 'tipo' => $registro['tipo'], 'resid' => $registro['resid']]; //var_dump($this->Resultado['resid']); return $this->Resultado; } }