How do I print the semesters on canvas

Asked

Viewed 39 times

0

I have this code, the query is already done, just call on the tag. How do I print on canvas the months of the semester after the goals.

<?php
 /* codigo para gerar os paramentros  */
    $ano        = $_POST["ano"];
    $_perspectiva = $_POST["perspectiva"];

    if ($_POST["semestre"] == "primeiro") {
        $_parametros = array (
        "ano" => $ano,
        "mes1" => 1, "mes2" => 2, "mes3" => 3,
        "mes4" => 4, "mes5" => 5, "mes6" => 6,
        "nomeMes1" => "Janeiro", "nomeMes2" => "Fervereiro", "nomeMes3" => "Março",
        "nomeMes4" => "Abril", "nomeMes5" => "Maio", "nomeMes6" => "Junho",
        "perspectiva" => $_perspectiva);
    }else if ($_POST["semestre"] == "segundo") {
        $_parametros = array (
        "ano" => $ano,
        "mes1" => 7, "mes2" => 8, "mes3" => 9,
        "mes4" => 10, "mes5" => 11, "mes6" => 12,
        "nomeMes1" => "Julho", "nomeMes2" => "Agosto", "nomeMes3" => "Setembro",
        "nomeMes4" => "Outubro", "nomeMes5" => "Novembro", "nomeMes6" => "Dezembro",
        "perspectiva" => $_perspectiva);
    }else {
        $error = "ERRO";
    }


    //Instanciando a classe
    $_model = new model_Indoperacionais();
    $_indoperacionais = $_model->RetornaIndoperacionais($ano);

        //echo "<pre>"; print_r ($_indoperacionais);exit;
          echo '<h3 align=left>'.'&nbsp&nbspArea de Gestao de Pessoas'.'</h3>';

     foreach($_indoperacionais as $_indoperacional){
          echo '<tr>';
          echo '<td align=center>'.$_indoperacional['nome_tema'].'</td>';
          echo '<td align=center>'.$_indoperacional['indicadores'].'</td>';
          echo '<td align=center>'.$_indoperacional['responsavel'].'</td>';
          echo '<td align=center>'.$_indoperacional['metas'].'</td>';
          echo '<td align=center>'.$_indoperacional['iniciativa_sequencia'].'</td>';
          echo '</tr>';
        //print_r($_parametros);
     }
    ?>


class model_Indoperacionais extends MysqlConnection{


private $indoperacionais;

public function RetornaIndoperacionais($ano){

    if($ano == '2016'){
        $_base = "pla_est_2016";
        $_base = "pla_est";

    }else{

    }

    $Query = ("SELECT i.codiniciativa,
    te.nome as nome_tema,
    te.codtemaestrategico as cod_te,
    p.observacoes as per_obs,
    te.sequencia as tem_sequencia,
    p.sigla as per_sigla,
    p.nome as nome_perspectiva,
    p.codperspectiva as cod_perspectiva,
    o.sequencia as sequencia_obj,
    o.codobjetivo as cod_obj,
    o.nome as nome_obj,concat(p.sigla, ' ', te.sequencia,
    '.', o.sequencia, '.',i.sequencia) as codigo,i.nome as nom_iniciativa,
    i.sequencia as iniciativa_sequencia,
    i.metas,i.responsavel,i.indicadores,
    ifnull((SELECT a. percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) = 2016 AND month(a.data) = 1 ORDER BY a.data DESC LIMIT 1),
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) <= 2016 AND month(a.data) < 1 AND curdate() >= '2016-01-01' ORDER BY a.data DESC LIMIT 1), 0)) as '01',
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) = 2016 AND month(a.data) = 2 ORDER BY a.data DESC LIMIT 1),
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) <= 2016 AND month(a.data) < 2 AND curdate() >= '2016-02-01' ORDER BY a.data DESC LIMIT 1), 0)) as '02',
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) = 2016 AND month(a.data) = 3 ORDER BY a.data DESC LIMIT 1),
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) <= 2016 AND month(a.data) < 3 AND curdate() >= '2016-03-01' ORDER BY a.data DESC LIMIT 1), 0)) as '03',
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) = 2016 AND month(a.data) = 4 ORDER BY a.data DESC LIMIT 1),
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) <= 2016 AND month(a.data) < 4 AND curdate() >= '2016-04-01' ORDER BY a.data DESC LIMIT 1), 0)) as '04',
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) = 2016 AND month(a.data) = 5 ORDER BY a.data DESC LIMIT 1),
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) <= 2016 AND month(a.data) < 5 AND curdate() >= '2016-05-01' ORDER BY a.data DESC LIMIT 1), 0)) as '05',
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) = 2016 AND month(a.data) = 6 ORDER BY a.data DESC LIMIT 1),
    ifnull((SELECT a.percentual FROM avaliacoes a WHERE a.status = 'A' AND a.codiniciativa = i.codiniciativa AND year(a.data) <= 2016 AND month(a.data) < 6 AND curdate() >= '2016-06-01' ORDER BY a.data DESC LIMIT 1), 0)) as '06'FROM perspectivas p  LEFT JOIN temasestrategicos te ON p.codperspectiva = te.codperspectiva LEFT JOIN objetivos o ON te.codtemaestrategico = o.codtemaestrategico LEFT JOIN iniciativas i ON o.codobjetivo = i.codobjetivo WHERE p.codperspectiva = '5' AND p.status = 'A' AND te.status = 'A' AND o.status = 'A' AND i.status = 'A'ORDER BY p.sequencia ASC,te.sequencia ASC,
    o.sequencia ASC,CAST(i.sequencia AS DECIMAL) ASC" ); 


    //echo "<pre>"; print_r($Query); exit;

    //while ($_indoperacionais = mysql_fecth_array($Query));
    try {
            $this->search = $this->MySql->prepare($Query);
            //$this->search->bindParam(":nome", $this->indoperacionais);
            $this->search->execute();

        } catch(PDOException $e) {
            die($e->getMessage());
        }

        $_result = $this->search->fetchAll(PDO::FETCH_ASSOC);
        return $_result;


   }
}
  • 2

    I don’t understand what it is you’re trying to do. I could explain it better?

  • What I can notice, is that the query echo is commented, the pre tag is not closed, and while is also commented.

  • estou imprimindo em tela html o que é listado do banco de dados , só que falta imprimir também o semestre , tipo a pessoa seleciona o primeiro , ai em imprimido em telas os meses do primeiro semestre . and also wanted to set $_base on the query as I do .

  • these are not changing anything .

  • @allanaraujo it would be interesting to give a more capricious in the questions, almost all of his were closed. Especially don’t repeat the same question you asked earlier. Stick to the first one. If she had problems, fix the problem and it will reopen.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.