D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Models
/
Cotacao
/
Filename :
ModCtNaoCotadoInativar.php
back
Copy
<?php namespace App\gre\Models\Cotacao; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GrsApagarEmpr * * @copyright (c) year, Carlos Marques - CM */ class ModCtNaoCotadoInativar { private $DadosId; private $Resultado; private $Dados; function getResultado() { return $this->Resultado; } public function inativarNaoCotado($DadosId = null) { $this->DadosId = filter_input_array(INPUT_GET, FILTER_DEFAULT); // var_dump($this->DadosId); // die; $data_cota = $this->DadosId['data']; $tipoInativa = "'".'C'."'"; if($this->DadosId['tipo'] == 'I'){ $this->Dados['status_id'] = 5; $incStatAnt = new \App\adms\Models\helper\AdmsProcedure5; $incStatAnt->exeProcedure("ct_inclui_stat_ant","'".$data_cota."'", $this->DadosId['forn_id'],$this->DadosId['repres_id'],0,$tipoInativa ); $upAltNaoCotado = new \App\adms\Models\helper\AdmsUpdate(); $upAltNaoCotado->exeUpdate("ct_cotacao", $this->Dados, "WHERE data =:data and forn_id = :forn_id and repres_id = :repres_id ", "data=" . $data_cota. "&forn_id=" . $this->DadosId['forn_id']. "&repres_id=" . $this->DadosId['repres_id']); // $upAltNaoCotadocota = new \App\adms\Models\helper\AdmsUpdate(); $upAltPreco = new \App\adms\Models\helper\AdmsUpdate(); $upAltPreco->exeUpdate("ct_precos", $this->Dados, "WHERE data_cotacao =:data and forn_id = :forn_id and repres_id = :repres_id ", "data=" . $data_cota. "&forn_id=" . $this->DadosId['forn_id']. "&repres_id=" . $this->DadosId['repres_id']); if ($upAltPreco->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Cotação Inativada 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: Cotação não foi Inativada !! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } if($this->DadosId['tipo'] == 'A'){ $upAltPreco = new \App\adms\Models\helper\AdmsProcedure5; $upAltPreco->exeProcedure("ct_retorna_stat_ant","'".$data_cota."'", $this->DadosId['forn_id'],$this->DadosId['repres_id'],0,$tipoInativa); /* $listTemPreco = new \App\adms\Models\helper\AdmsRead(); $listTemPreco->fullRead("select count(*) itens from ct_cotacao where preco_cotado > 0 and data = :data and status_id = 5 and forn_id = :forn_id and repres_id = :repres_id", "data=" . $data_cota. "&forn_id=" . $this->DadosId['forn_id']. "&repres_id=" . $this->DadosId['repres_id']); $this->Resultado = $listTemPreco->getResultado(); // var_dump($this->Resultado[0]['itens']); if ($this->Resultado[0]['itens'] > 0){ $this->Dados['status_id'] = 3; }else{ $this->Dados['status_id'] = 2; } // var_dump( $this->Dados['status_id']); // exit; $upAltNaoCotado->exeUpdate("ct_cotacao", $this->Dados, "WHERE data =:data and status_id = 5 and forn_id = :forn_id and repres_id = :repres_id ", "data=" . $data_cota. "&forn_id=" . $this->DadosId['forn_id']. "&repres_id=" . $this->DadosId['repres_id']); // $upAltNaoCotado->exeUpdate("ct_precos", $this->Dados, "WHERE data_cotacao =:data and forn_id = :forn_id and repres_id = :repres_id", "data=" . $data_cota . "&forn_id=" . $this->DadosId['forn_id']. "&repres_id=" . $this->DadosId['repres_id']); $upAltPreco = new \App\adms\Models\helper\AdmsUpdate(); $upAltPreco->exeUpdate("ct_precos", $this->Dados, "WHERE data_cotacao =:data and forn_id = :forn_id and repres_id = :repres_id ", "data=" . $data_cota. "&forn_id=" . $this->DadosId['forn_id']. "&repres_id=" . $this->DadosId['repres_id']); * */ if ($upAltPreco->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Cotação Ativada 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: Cotação não foi Ativada !! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } } }