D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso_ant
/
adm
/
app
/
gre
/
Models
/
Filename :
GreApagarEstoqueAcolhimento.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreApagarEstoqueAcolhimento * * @copyright (c) year, Carlos Marques - CM */ class GreApagarEstoqueAcolhimento { private $DadosId; private $Resultado; function getResultado() { return $this->Resultado; } public function apagarEstAcolh() { $this->DadosId = filter_input_array(INPUT_GET, FILTER_DEFAULT); $this->verRegDisp(); if ($this->Resultado) { $apagarEstAcolh = new \App\adms\Models\helper\AdmsDelete(); $apagarEstAcolh->exeDelete("gre_est_mov_residente", "WHERE gre_produto_id =:prod_id and gre_residente_id = :resid_id", "prod_id={$this->DadosId['p']} &resid_id={$this->DadosId['res']} "); if ($apagarEstAcolh->getResultado()) { $apagarEstoque = new \App\adms\Models\helper\AdmsDelete(); $apagarEstoque->exeDelete("gre_estoque_residente", "WHERE gre_produto_id =:prod_id and gre_residente_id= :resid_id", "prod_id={$this->DadosId['p']} &resid_id={$this->DadosId['res']}"); if ($apagarEstoque->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Estoque excluido 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: Estoque não foi excluido! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } } } private function verRegDisp() { $verRegDisp = new \App\adms\Models\helper\AdmsRead(); $verRegDisp->fullRead("SELECT gre_tipo_lancamento_id FROM gre_est_mov_residente WHERE gre_residente_id = :resid_id and gre_tipo_lancamento_id <> 0 and gre_produto_id = :prod_id LIMIT :limit", "resid_id=" . $this->DadosId['res'] . "&prod_id=" . $this->DadosId['p'] . "&limit=1"); if ($verRegDisp->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Estoque não pode ser apagado, já houveram outros Lançamentos para o residente ! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } else { $this->Resultado = true; } } }