mardi 28 août 2018

Loops, what and how to use? (for, while, and foreach)

What's up guys!

I have a problem and I can not think of a solution.

I need to make a report using DOMPDF. In this report, i need to print some employee information. In each page it is necessary to have header for the signature of the person in charge.

I have a group of employees. They are divided by departments.

I need a "break the page" loop when I change the employee's department or when I print 15 employees. After that, the loop should print the rest of the employees and execute the same rules if you change the employee's department again or have already been printed 15 employees.

<!DOCTYPE html>
<html lang="">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Relatório Geral</title>
    <style>

        body {
            margin-top: -20px;
            margin-left: -20px;
            margin-right: -5px;
            padding:0
        }

        .borda3 {
            border:1px solid #999;
            padding: 5px;
        }

        #borda2 td {
            border: 1px solid #999;
            border-collapse: collapse;
            width: auto;

        }

        .centro {
            text-align: center;
        }

        .tabela {
            width: 100%;
        }

        span {
            font-size: 100px;
        }

        td {
            font-size: 11px;
        }

        html {
            font-family: sans-serif;
        }

        #customers {
            font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
            border-collapse: collapse;
            width: 100%;
        }

        #customers td, #customers th {
            border: 1px solid #ddd;

        }

        #customers tr:nth-child(even){background-color: #f2f2f2;}

        #customers tr:hover {background-color: #ddd;}

        #customers th {
            text-align: center;
            font-size: 9px;
        }

        #customers td {
            text-align: left;
            font-size: 10px;
        }

        #customers a {
            font-size: 10px;
        }

        .nome{
            width: 180px;
        }

        .matricula{
            width: 15px;
        }

        .numeros{
            width: 15px;
        }

        .logo{
            padding-left: 50px;

        }

        .logo a strong{
            font-size: 15px;
            text-align: center;
        }

        .logo a{
            font-size: 12px;
        }

        .assinatura{
            font-size: 9px;
            margin-left: 60px;

        }
    </style>
</head>

<body>
    <table class="tabela borda3">
        <tr>
            <td width="40%" class="centro">
                <table class="logo">
                    <tr>
                        <td>
                            <img style="margin-left:20px; margin-top: -20px;width:220px; height: 65px;" src="img/logo_sarh.jpg">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for=""><a><strong> </strong></a></label><br>
                        </td>
                    </tr>
                    <tr>
                        <td><a>Referência:</a></td>
                    </tr>
                    <tr>
                        <td><a>Período:</a></td>
                    </tr>
                </table>
            </td>
            <td width="40%" class="centro">
                <table class="assinatura">
                    <tr>
                        <td style="height: 30px; text-align: left"><label for="">Em: _____/ _____/___________</label></td>
                    </tr>
                    <tr>
                        <td style="padding-bottom: -20px; height: 50px; text-align: center">
                            <label for="">____________________________________________</label><br>
                         <label style="font-size: 10px" for=""> SUPERVISOR</label>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 30px; text-align: left"><label for="">VISTO</label></td>
                    </tr>
                    <tr>
                        <td style="padding-bottom: -10px; height: 50px; text-align: center">
                            <label for="">____________________________________________</label><br>
                            <label style="font-size: 10px" for=""> SECRETÁRIO(A)</label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <br>
    <table id="customers">
        <tr>
            <th class="nome">Nome</th>
            <th class="matricula">Matrícula</th>
            <th class="numeros">Dias</th>
            <th class="numeros">Faltas</th>
            <th class="numeros">Vac</th>
            <th class="numeros">LSV</th>
            <th class="numeros">L M</th>
            <th class="numeros">Aci. Trab</th>
            <th class="numeros">Adi. Not</th>
            <th class="numeros">H.E Normal D</th>
            <th class="numeros">H.E Normal N</th>
            <th class="numeros">H.E Dom/Fer. D</th>
            <th class="numeros">H.E Dom/Fer. N</th>
            <th class="numeros">Ins.</th>
        </tr>
        
        <tr>
            <td style="height: 20px;"><a>Augusto Damasceno Pedrozo</a></td>
            <td style="height: 20px;"><a>12345678</a></td>
            <td style="height: 20px;"><a>30</a></td>
            <td style="height: 20px;"><a>2</a></td>
            <td style="height: 20px;"><a>2</a></td>
            <td style="height: 20px;"><a>2</a></td>
            <td style="height: 20px;"><a>2</a></td>
            <td style="height: 20px;"><a>2</a></td>
            <td style="height: 20px;"><a>2</a></td>
            <td style="height: 20px;"><a>20,02</a></td>
            <td style="height: 20px;"><a>20,02</a></td>
            <td style="height: 20px;"><a>20,02</a></td>
            <td style="height: 20px;"><a>20,02</a></td>
            <td style="height: 20px;"><a>20</a></td>
        </tr>
        <tr>
            <td style="height: 20px;" colspan="14">Observação:</td>
        </tr>
        
    </table>
</body>

</html>

Could anyone give me some direction to solve this?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2wg7shx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire