D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Models
/
Filename :
ModFilialCadastrar.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of ModFilialCadastrar * * @copyright (c) year,Carlos Marques CM */ class ModFilialCadastrar { private $Resultado; private $Dados; private $UltimoFili; private $ResCnpj; private $contCnpj; private $idCliente; private $Logo; private $substituicao = array( ' ' => '', '_' => '', '-' => '', '/' => '', '.' => '', ',' => '', '(' => '', ')' => '' ); function getResultado() { return $this->Resultado; } public function cadFili(array $Dados) { $this->Dados = $Dados; $this->verFilialDuplo(); if ($this->Resultado) { $this->inserirFilial(); } } public function inserirFilial(){ var_dump($this->Dados); $cadFili = new \App\adms\Models\helper\AdmsCreate; $cadFili->exeCreate("ro_filial", $this->Dados); // var_dump($cadFili->getResultado()); if ($cadFili->getResultado() == 0) { $_SESSION['msg'] = "<div class='alert alert-success'Filial cadastrada com sucesso!</div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger'>Erro: Filial não foi cadastrado!</div>"; $this->Resultado = false; } } public function verFilialDuplo(){ { $verFilialDuplo = new \App\adms\Models\helper\AdmsRead(); $verFilialDuplo->fullRead("SELECT id FROM ro_filial WHERE id= :filial_id LIMIT :limit", "filial_id=" . $this->Dados['id']. "&limit=1"); if ($verFilialDuplo->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-danger'>Erro: Filial já cadastrada!</div>"; $this->Resultado = false; } else { $this->Resultado = true; } } } public function listarCadastrar() { $listar = new \App\adms\Models\helper\AdmsRead(); $listar->fullRead("SELECT id id_cluster, nome nome_cluster FROM ro_cluster ORDER BY nome, tamanho ASC"); $registro['cluster'] = $listar->getResultado(); $listar->fullRead("SELECT esp.id esp_id, esp.nome esp_nome from ro_filial esp where esp.situacao_id = 1 and esp.id < 999 order by esp.id"); $registro['esp'] = $listar->getResultado(); $listar->fullRead("SELECT id id_sit, nome nome_sit FROM adms_sits ORDER BY nome ASC"); $registro['sit'] = $listar->getResultado(); $listar->fullRead("SELECT id id_empr, nome_fantasia nome_empr FROM ro_empresa where id = 2 ORDER BY nome ASC"); $registro['empr'] = $listar->getResultado(); $this->Resultado = ['sit' => $registro['sit'],'esp' => $registro['esp'], 'empr' => $registro['empr'],'cluster' => $registro['cluster']]; return $this->Resultado; } }