D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Models
/
Filename :
ModMixGenericoLer.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of ModTradeRepasseLer * * @copyright (c) year, Carlos Marques - CM */ class ModMixGenericoLer { private $Resultado; private $Dados; public function lerLanc($DadosId = null) { $this->Dados = $DadosId; // var_dump($this->Dados); $lerLanc = new \App\adms\Models\helper\AdmsRead(); $lerLanc->fullRead("select d.id dcb_id, max(d.nome) dcb_nome, max(a.nome) apres, count(*) qtde_filiais, max(s.dias) dias, date_format(max(p.data_inclusao),'%m/%y') data_inclusao, p.id produto_id, max(m.nome) marca_nome, max(p.nome) produto_nome, format(sum(s.qtde_estoque), 0, 'de_DE') estoque, format(sum(s.qtde_total), 0, 'de_DE') qtde_venda, format(round(sum(s.qtde_total) / AVG(dias),4), 4, 'de_DE') qtde_dia, format(round((sum(s.qtde_total) * 100) / (select sum(v.qtde_total) from ro_venda_semestre v join ro_produto x on x.id = v.produto_id inner join ro_apresentacao y on y.produto_id = x.id where x.dcb_id = p.dcb_id and y.nome = a.nome and x.situacao_id = 1 and x.status_compras_id = 1),2), 2, 'de_DE') part_venda_unid, format(sum(cus_total), 2, 'de_DE') custo_total, format(sum(s.ven_total), 2, 'de_DE') venda_total, format(p.preco_max, 2, 'de_DE') preco_max, format(p.preco_fabr, 2, 'de_DE') preco_fabr, format(round(((1-(sum(s.ven_total )/ sum(s.qtde_total)) / p.preco_max)*100),2), 2, 'de_DE') desconto, format(round((sum(s.ven_total)/ sum(s.qtde_total)), 2), 2, 'de_DE') preco_de_venda_medio, format(round((sum(s.ven_total) - sum(s.cus_total) ),2), 2, 'de_DE') mb, round(((sum(s.ven_total) - sum(s.cus_total) ) * 100) / sum(s.ven_total),2) lb_i, format(round(((sum(s.ven_total) - sum(s.cus_total) ) * 100) / sum(s.ven_total),2), 2, 'de_DE') lb, (select round((sum(v.ven_total) - sum(v.cus_total) )*100/sum(v.ven_total),2) from ro_venda_semestre v join ro_produto x on x.id = v.produto_id inner join ro_apresentacao y on y.produto_id = x.id where x.dcb_id = p.dcb_id and y.nome = a.nome and x.situacao_id = 1 and x.status_compras_id = 1) mb_media from ro_produto p inner join ro_venda_semestre s on s.produto_id = p.id inner join ro_marca m on m.id = p.marca_id inner join ro_apresentacao a on a.produto_id = p.id inner join ro_dcb d on d.id = p.dcb_id where p.dcb_id = :dcb_id and a.nome = :apres and p.situacao_id = 1 and p.status_compras_id = 1 group by d.id, p.id order by p.nome", "dcb_id={$this->Dados['dcb_id']}&apres={$this->Dados['apres_nome']}"); $this->Resultado = $lerLanc->getResultado(); //var_dump($this->Resultado); return $this->Resultado; } }