D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreApagarEstTipoLancamento.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GrsApagarEstTipoLancamento * * @copyright (c) year, Carlos Marques - CM */ class GreApagarEstTipoLancamento { private $DadosId; private $Resultado; private $Dados; function getResultado() { return $this->Resultado; } public function apagarEstTipoLanc($DadosId = null) { $this->DadosId = (int) $DadosId; $this->verLancamento(); if ($this->Resultado) { $EstTipoLanc = new \App\adms\Models\helper\AdmsDelete(); $EstTipoLanc->exeDelete("gre_est_tipo_lancamento", "WHERE id =:id", "id={$this->DadosId}"); if ($EstTipoLanc->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Tipo de Lançamento 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: Tipo de Lançamento 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 verLancamento() { $verTipoEstTipoLanc = new \App\adms\Models\helper\AdmsRead(); $verTipoEstTipoLanc->fullRead("SELECT id FROM gre_est_lancamento WHERE gre_tipo_lancamento_id= :tipolanc_id LIMIT :limit", "tipolanc_id=" . $this->DadosId . "&limit=1"); if ($verTipoEstTipoLanc->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Tipo de Lançamento não pode ser apagado, existe Movimento de Estoque com esse Tipo! <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; } } }