D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Models
/
Filename :
ModExcessoCompProd.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of ModRupCompProd * * @copyright (c) year, Carlos Marques - CM */ class ModExcessoCompProd { private $Resultado; private $Dados; private $diase; public function listCompProd() { $this->Dados = filter_input_array(INPUT_GET, FILTER_DEFAULT); // var_dump($this->Dados); $lerLanc = new \App\adms\Models\helper\AdmsRead(); if ($this->Dados['curva'] <> 'T' ) { // var_dump($this->Dados['data'].'<br>'); // var_dump($this->Dados['comp'].'<br>'); // var_dump($this->Dados['curva'].'<br>'); // $this->Dados['curva'] = "'".$this->Dados['curva']."'"; $this->Dados['data'] = substr($this->Dados['data'], 0, 10); $lerLanc->fullRead("select max(p.nome) nome, max(c.nome) comp_nome, date_format(r.data, '%d/%m/%y') data_i, data data_s, max(r.curvag) curva, 'A', r.comp_id, r.produto_id, max(p.pbm) pbm, date_format(max(p.data_inclusao), '%d/%m/%y') data_inclusao, count(*) qtde_filiais, round(avg(r.dias_max),0) dias_max, round(sum(r.qtde_estoque),0) qtde_estoque_real, round(sum(r.valor_estoque_real),0) valor_estoque_real, round(sum(r.qtde_est_max),0) qtde_est_max, round(sum(r.valor_est_max),0) valor_est_max, round(sum(r.qtde_excesso),0) qtde_excesso, round(sum(r.valor_excesso),0) valor_excesso from ro_excesso r inner join ro_produto p on p.id = r.produto_id inner join ro_comprador c on c.id = r.comp_id where r.data = :data and r.curvag = :curva and r.comp_id = :comp_id group by r.produto_id, r.data order by valor_excesso desc;", "curva={$this->Dados['curva']}&data={$this->Dados['data']}&comp_id={$this->Dados['comp']}"); }else{ $lerLanc->fullRead("select max(p.nome) nome, max(c.nome) comp_nome, date_format(r.data, '%d/%m/%y') data_i, data data_s, max(r.curvag) curva, 'A', r.comp_id, r.produto_id, max(p.pbm) pbm, date_format(max(p.data_inclusao), '%d/%m/%y') data_inclusao, count(*) qtde_filiais, round(avg(r.dias_max),0) dias_max, round(sum(r.qtde_estoque),0) qtde_estoque_real, round(sum(r.valor_estoque_real),0) valor_estoque_real, round(sum(r.qtde_est_max),0) qtde_est_max, round(sum(r.valor_est_max),0) valor_est_max, round(sum(r.qtde_excesso),0) qtde_excesso, round(sum(r.valor_excesso),0) valor_excesso from ro_excesso r inner join ro_produto p on p.id = r.produto_id inner join ro_comprador c on c.id = r.comp_id where r.data = :data and r.comp_id = :comp_id group by r.produto_id, r.data order by valor_excesso desc;", "data={$this->Dados['data']}&comp_id={$this->Dados['comp']}"); } $this->Resultado= $lerLanc->getResultado(); if(!empty($this->Resultado)) { $this->Resultado[0]['curva_sel'] = $this->Dados['curva']; } //var_dump( $this->Resultado); return $this->Resultado; } }