示例#1
0
 public function postos($queixas)
 {
     foreach (Setor::orderBy('descricao')->get() as $setor) {
         if (!empty($setor->postoTrabalhos->count())) {
             $this->AddPage();
             $this->setFillColor(150);
             $this->Cell(0, 5, utf8_decode('SETOR - ' . $setor->descricao), 1, 0, 'C', 1);
             //$this->Ln(15);
             $this->Ln();
             $this->setFont('Arial', '', 6);
             $this->Cell(50, 30, 'POSTO DE TRABALHO', 1, 0, 'l', 0);
             $this->Ln();
             //-- Lista de Causas --//
             $this->Rotate(90);
             $this->Ln(50);
             $qs = null;
             foreach ($queixas->get() as $queixa) {
                 $this->setFillColor(230);
                 $this->Cell(30, 4, utf8_decode($queixa->descricao), 1, 0, 'l', 1);
                 $qs[] = $queixa;
                 $this->Ln();
             }
             $this->Cell(30, 4, utf8_decode('TOTAL DO POSTO'), 1, 0, 'l', 1);
             $this->Rotate(0);
             $this->SetAutoPageBreak(true, 5);
             $linhas = -($queixas->count() * 4 + 50);
             //-- Fim ista de Causas --//
             $this->Ln($linhas);
             unset($totalQueixas);
             foreach ($setor->postoTrabalhos as $posto) {
                 $this->setFillColor(200);
                 $this->Cell(50, 4, utf8_decode(substr($posto->descricao, 0, 37)), 1, 0, 'l', 0);
                 $totalQueixaPosto = 0;
                 foreach ($qs as $q) {
                     $totalQueixa = Ocorrencia::where('setor_id', $setor->id)->where('posto_id', $posto->id)->where('queixa_id', $q->id)->count();
                     $this->Cell(4, 4, $totalQueixa, 1, 0, 'C', 0);
                     if (empty($totalQueixas[$q->id])) {
                         $totalQueixas[$q->id] = 0;
                     }
                     $totalQueixas[$q->id] = $totalQueixa + $totalQueixas[$q->id];
                     $totalQueixaPosto = $totalQueixaPosto + $totalQueixa;
                 }
                 $this->Cell(4, 4, $totalQueixaPosto, 1, 0, 'C', 1);
                 $this->Ln();
             }
             $this->Cell(50, 4, utf8_decode('TOTAL DA QUEIXA'), 1, 0, 'l', 1);
             foreach ($totalQueixas as $total) {
                 $this->Cell(4, 4, $total, 1, 0, 'C', 1);
             }
             $this->Ln();
         }
     }
 }
示例#2
0
 public function setors($exames)
 {
     foreach (Setor::orderBy('descricao')->get() as $setor) {
         if (!empty($setor->postoTrabalhos->count())) {
             $this->SetFillColor(150);
             $this->Cell(190, 5, utf8_decode($setor->descricao), 1, 0, 'C', 1);
             $this->Ln();
             $this->SetFillColor(200);
             $this->Cell(50, 4, utf8_decode('Posto de Trabalho'), 1, 0, 'C', 1);
             $this->Cell(80, 4, utf8_decode('Tipo de Exame'), 1, 0, 'C', 1);
             $this->Cell(15, 4, utf8_decode('Total'), 1, 0, 'C', 1);
             $this->Cell(15, 4, utf8_decode('Alterados'), 1, 0, 'C', 1);
             $this->SetFont('Arial', '', 6);
             $this->Cell(21, 4, utf8_decode('Alterados * 100/Total'), 1, 0, 0, 1);
             $this->Ln();
             foreach ($setor->postoTrabalhos()->orderBy('descricao')->get() as $posto) {
                 $aso = Aso::where('colaborador_setor_id', $setor->id)->where('posto_id', $posto->id)->lists('id');
                 if (count($posto->asos) && AsoExame::whereIn('relacao_id', $aso)->count() != 0) {
                     $this->SetFillColor(240);
                     $this->SetFont('Arial', '', 9);
                     $this->Cell(50, 4, utf8_decode($posto->descricao), 1, 0, 'L', 1);
                     $count = 0;
                     foreach (Exame::all() as $exame) {
                         $exames = AsoExame::where('exame_id', $exame->id)->whereIn('relacao_id', $aso)->count();
                         $alterado = AsoExame::where('exame_id', $exame->id)->whereIn('relacao_id', $aso)->whereNotIn('resultado', ['normal', 'NÃO REAGENTE', 'NORMAL', 'norm', 'NORMA'])->count();
                         if ($exames != 0) {
                             if ($count == 0) {
                                 $this->Cell(80, 4, utf8_decode($exame->descricao), 1, 0, 'L', 0);
                                 $this->Cell(15, 4, $exames, 1, 0, 'L', 0);
                                 $this->Cell(15, 4, $alterado, 1, 0, 'L', 0);
                                 $this->Cell(21, 4, number_format($alterado * 100 / $exames, 2, ',', '.') . ' %', 1, 0, 'R', 0);
                                 $this->Ln();
                             } else {
                                 $this->Cell(50, 4, '', 0, 0, 'L', 0);
                                 $this->Cell(80, 4, utf8_encode($exame->descricao), 1, 0, 'L', 0);
                                 $this->Cell(15, 4, $exames, 1, 0, 'L', 0);
                                 $this->Cell(15, 4, $alterado, 1, 0, 'L', 0);
                                 $this->Cell(21, 4, number_format($alterado * 100 / $exames, 2, ',', '.') . ' %', 1, 0, 'R', 0);
                                 $this->Ln();
                             }
                             if (empty($totalExame[$exame->descricao])) {
                                 $totalExame[$exame->descricao] = 0;
                             }
                             if (empty($totalAlterados[$exame->descricao])) {
                                 $totalAlterados[$exame->descricao] = 0;
                             }
                             $totalExame[$exame->descricao] = $exames + $totalExame[$exame->descricao];
                             $totalAlterados[$exame->descricao] = $alterado + $totalAlterados[$exame->descricao];
                             $count = $count + 1;
                         }
                     }
                     $this->Ln();
                 }
             }
             $this->AddPage();
         }
     }
     $this->Cell(190, 7, utf8_decode('Total de Exames Realizados'), 1, 0, 'C', 1);
     $this->Ln();
     $this->Cell(80, 6, utf8_decode('Descrição'), 'BLT', 0, 'C', 1);
     $this->Cell(30, 6, 'Realizados', 'BLT', 0, 'C', 1);
     $this->Cell(30, 6, 'Alterados', 'BLT', 0, 'C', 1);
     $this->Cell(40, 6, 'Alterados*100/Realizados', 1, 0, 'C', 1);
     $this->Ln();
     foreach ($totalExame as $exame => $valor) {
         $this->Cell(80, 6, utf8_decode($exame), 'BLT', 0, 'L');
         $this->Cell(30, 6, $totalExame[$exame], 'BLT', 0, 'C');
         $this->Cell(30, 6, $totalAlterados[$exame], 'BLT', 0, 'C');
         $this->Cell(40, 6, number_format($totalAlterados[$exame] * 100 / $totalExame[$exame], 2, ',', '.') . ' %', 1, 0, 'C');
         $this->Ln();
     }
 }