D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Models
/
Filename :
ModRupFilialLer.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of ModTradeRepasseLer * * @copyright (c) year, Carlos Marques - CM */ class ModRupFilialLer { private $Resultado; private $Dados; public function lerLanc($DadosId = null) { $this->Dados = $DadosId; $lerLanc = new \App\adms\Models\helper\AdmsRead(); $lerLanc->fullRead("select c.nome filial_nome, i.filial_id, case when date_format(i.data ,'%w') = 0 then concat(date_format(i.data, '%d/%m'), '-', 'Dom') when date_format(i.data ,'%w') = 1 then concat(date_format(i.data, '%d/%m'), '-', 'Seg') when date_format(i.data ,'%w') = 2 then concat(date_format(i.data, '%d/%m'), '-', 'Ter') when date_format(i.data ,'%w') = 3 then concat(date_format(i.data, '%d/%m'), '-', 'Qua') when date_format(i.data ,'%w') = 4 then concat(date_format(i.data, '%d/%m'), '-', 'Qui') when date_format(i.data ,'%w') = 5 then concat(date_format(i.data, '%d/%m'), '-', 'Sex') when date_format(i.data ,'%w') = 6 then concat(date_format(i.data, '%d/%m'), '-', 'Sab') end data1, round(avg(i.perc_a),2) A, round(avg(i.perc_b),2) B, round(avg(i.perc_c),2) C, round(avg(i.perc_d),2) D, round(avg(i.perc_t),2) T from ro_rup_indice_filial i INNER join ro_filial c on c.id = i.filial_id where i.filial_id = :filial_id and i.data >= date_sub(curdate(), interval 31 day) GROUP BY c.nome,i.data ORDER BY i.data desc", "filial_id=".$this->Dados['filial_id']); $this->Resultado= $lerLanc->getResultado(); if(!empty($this->Resultado)) { if(!isset($this->Resultado[0]['data_sel'])) { $this->Resultado[0]['data_sel'] = $this->Dados['data_sel']; } if(!isset($this->Resultado[0]['filial_sel'])) { $this->Resultado[0]['filial_sel'] = $this->Dados['filial_sel']; } if(!isset($this->Resultado[0]['filial_sel'])) { $this->Resultado[0]['filial_sel'] = $this->Dados['filial_sel']; } } //var_dump($this->Resultado); return $this->Resultado; } }