Creating / Viewing Report in HTML

1

I have a problem and I could not think of a solution ... People who have already used iReport know that it has to be grouped very easily in it ... The problem is that I am now doing HTML reports (on the nail rs), and wanted to group by branch (as an example):

Filial  001 - LOJA TAL
                              column         column          column         column        column
                              dados           dados            dados           dados          dados
                              dados           dados            dados           dados          dados 
                              dados           dados            dados           dados          dados
Total da Filial 001  =        TOTAL          TOTAL           TOTAL          TOTAL         TOTAL

Filial  002 - LOJA TAL
                              column         column          column         column        column
                              dados           dados            dados           dados          dados
                              dados           dados            dados           dados          dados 
                              dados           dados            dados           dados          dados
Total da Filial 002  =        TOTAL          TOTAL           TOTAL          TOTAL         TOTAL

Total Geral           =       TOTAL GERAL

And so on .. in iReport is just putting a group ... But now that I'm doing in HTML, I can not find a solution to my problem ... Because it is repeating the name of the branch in all lines, and I could not think of how to do the total for affiliate and then the Overall total ...

Example:

Let's say the numbers (query result) (1, 1, 1, 1, 2, 2, 2, 3, 3, p>

I've tried to get the values from the branch table and compare with the branch result that is coming from the query, but it did not work, it continues to print repeatedly.

For example:

 $filias => $this->find(filiais)
 $dadosConsulta['numero_filial'] (este aqui que está vindo repetido, filial para cada resultado)

 if($filiais['numero_filial'] == $dadosConsulta['numero_filial']){
 echo $dadosConsulta['numero_filial'];
 }

I tried something like this above, but it also did not work ... still repeated printava. I would like your help! Thanks.

Edit:

Follow image .. At the end when you change branch from 1 to 2 and 2 to 3, so successively, printar Total per Branch, boils down to it! Because the way I'm doing, it's being printed after every result by seller. Several times.

    
asked by anonymous 15.09.2015 / 12:55

1 answer

1

If everything comes in a select only, you can try something like this:

$filialAnterior = -1;
for/while/foreach (o que vc usar para o loop){
     if($filialAnterior === $dadosConsulta['numero_filial']){
        // escreve dados
        // conta total da filial
     }else{
        // mudou filial
        // escreve total da filial
        // abre cabeçalho da nova filial
        // zera total da filial
        $filialAnterior =  $dadosConsulta['numero_filial'];
     }
}
    
15.09.2015 / 14:34