public function executa() { $inicio = date("Y-m-01"); $fim = date("Y-m-t"); setlocale(LC_ALL, "pt_BR"); $mes = strftime('%B'); $dao = new MercadoDAO(); $ranking = $dao->getRankingVendas($inicio, $fim, "geral"); $this->setJsInterno(array('assets/js/tabela.js', 'assets/plugins/datable/jquery.dataTables.min.js', 'assets/plugins/datable/dataTables.bootstrap.min.js')); $this->setDados('titulo', 'Ranking'); $this->setDados('mes', $mes); $this->setDados('ranking', $ranking); $this->setPagina('views/ranking.php'); $this->getCompleto(); }
public function executa() { $inicio = strtotime(date("Y-m-01")); $fim = strtotime(date("Y-m-t")); $tipo = isset($_POST['tipo'][0]) ? $_POST['tipo'] : "geral"; $busca = array(); $busca['tipo'] = $tipo; $intervalo = false; if (isset($_POST['inicio'][0])) { $inicio = strtotime($_POST['inicio']); if (isset($_POST['fim'][0])) { $intervalo = true; $fim = strtotime($_POST['fim']); } else { $inicio = strtotime(date("Y-m-01")); } } else { if (isset($_POST['mes'][0])) { $inicio = strtotime(date((int) $_POST['mes'] . '/01/y')); $fim = strtotime(date('Y-m-t', $inicio)); } } setlocale(LC_ALL, "pt_BR"); if ($intervalo) { $busca['descricao'] = strftime('%d/%b/%Y', $inicio) . ' a ' . strftime('%d/%b/%Y', $fim); } else { $busca['descricao'] = strftime('%B', $inicio); } $busca['mes'] = date("m", $inicio); $inicio = date("Y-m-d", $inicio); $fim = date("Y-m-d", $fim); $this->setJsInterno(array('assets/js/tabela.js', 'assets/plugins/datable/jquery.dataTables.min.js', 'assets/plugins/datable/dataTables.bootstrap.min.js')); $this->setDados('titulo', 'Ranking | Administração'); $dao = new MercadoDAO(); $ranking = $dao->getRankingVendas($inicio, $fim, $tipo); $this->setDados('ranking', $ranking); $this->setDados('busca', $busca); $this->setPagina('views/ranking-adm.php'); $this->getCompleto(); }