D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso_ant
/
adm
/
app
/
gre
/
Controllers
/
Filename :
EntradaMerc.php
back
Copy
<?php namespace App\gre\Controllers; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of EntradaMerc * * @copyright (c) year, Carlos Marques - CM */ class EntradaMerc { private $Dados; private $DadosForm; private $DadosGrv; private $PageId; public function listar($PageId = null) { $botao = ['list_ent_merc' => ['menu_controller' => 'entrada-merc', 'menu_metodo' => 'listar'], 'edit_ent_merc' => ['menu_controller' => 'editar-entrada-merc', 'menu_metodo' => 'editent-merc'], 'baix_ent_merc' => ['menu_controller' => 'baixar-entrada-merc', 'menu_metodo' => 'bax-baixa-cp_cr'], 'del_entr_merc' => ['menu_controller' => 'apagar-entrada-merc', 'menu_metodo' => 'apagarent-merc']]; $listarBotao = new \App\adms\Models\AdmsBotao(); $this->Dados['botao'] = $listarBotao->valBotao($botao); $listarMenu = new \App\adms\Models\AdmsMenu(); $this->Dados['menu'] = $listarMenu->itemMenu(); $this->DadosForm = filter_input_array(INPUT_POST, FILTER_DEFAULT); if (!empty($this->DadosForm['EntMerc'])) { unset($this->DadosForm['EntMerc']); $this->Dadosgrv=$this->DadosForm; var_dump($this->Dadosgrv); $entMerc = new \App\gre\Models\GreEntMerc(); $entMerc->entMerc($this->Dados); if ($entMerc->getResultado()) { $grvMerc = new \App\gre\Models\GreEntrarPedido(); $grvMerc->fecPed($this->Dadosgrv); $this->Resultado = true; $_SESSION['msg'] = "<div class='alert alert-success'>Entrada realizada com sucesso!</div>"; $UrlDestino = URLADM . 'entrada-merc/listar/' ; header("Location: $UrlDestino"); }else{ $_SESSION['msg'] = "<div class='alert alert-danger'>Erro: Entrada não foi completamente atualizada , Verifique !</div>"; $this->Resultado = false; } } else{ $this->cadEntMercViewPriv(); } // $baixaEntMerc = new \App\adms\Models\helper\AdmsUpdate(); if (!empty($this->DadosForm['ListEntMerc'])) { unset($this->DadosForm['ListEntMerc']); } else { $this->PageId = (int) $PageId ? $PageId : 1; $this->DadosForm['nome_filial'] = filter_input(INPUT_GET, 'nome_filial', FILTER_DEFAULT); $this->DadosForm['filial_nome'] = filter_input(INPUT_GET, 'filial_nome', FILTER_DEFAULT); } $listarEntMerc = new \App\gre\Models\GreListarEntradaMerc(); $this->Dados['listEntMerc'] = $listarEntMerc->listarEntMerc($this->PageId, $this->DadosForm); $this->Dados['paginacao'] = $listarEntMerc->getResultadoPg(); $carregarView = new \App\gre\core\ConfigViewList("gre/Views/EntradaMercadoria/listarEntradaMerc", $this->Dados); $carregarView->renderizarGre(); } private function cadEntMercViewPriv() { $listarSelect = new \App\gre\Models\GreListarEntradaMerc(); $this->Dados['select'] = $listarSelect->listarCadastrar(); } }