Example #1
0
 public static function relatorioAtestados()
 {
     Excel::create('Planilha de Controle da Farmacia - Atestado / Cesta Básica', function ($excel) {
         $excel->sheet('Excel sheet', function ($sheet) {
             $sheet->mergeCells('A1:J5');
             $sheet->setHeight(1, 50);
             $sheet->row(1, function ($row) {
                 $row->setFontFamily('Arial');
                 $row->setFontSize(20);
             });
             $sheet->cell('A1', function ($cell) {
                 $cell->setAlignment('center');
             });
             $sheet->row(1, array('Frizelo Frigorificos Ltda.'));
             $sheet->setAutoFilter('A6:J6');
             $sheet->setOrientation('landscape');
             $input = Input::all();
             $periodo = explode(' - ', $input['periodo']);
             $atestados = OcorrenciaAtestado::whereBetween('inicio_afastamento', $periodo)->get();
             $return = null;
             foreach ($atestados as $atestado) {
                 if (empty($atestado->getCid->descricao)) {
                     $cid = $atestado->cid;
                 } else {
                     $cid = $atestado->getCid->cod_cid . ' - ' . $atestado->getCid->descricao;
                 }
                 $return[] = ['matricula' => $atestado->ocorrencia->colaborador->codigo_interno, 'nome' => $atestado->ocorrencia->colaborador->nome, 'setor' => $atestado->ocorrencia->colaborador->setor->descricao, 'data inicio' => Format::viewDate($atestado->inicio_afastamento), 'fim afastamento' => Format::viewDate($atestado->fim_afastamento), 'descricao' => $atestado->tipoDescricao, 'obs' => $atestado->obs, 'cid' => $cid, 'medico' => $atestado->profissional, 'Total Dias' => $atestado->dias_afastamento];
             }
             $sheet->fromArray($return, null, 'A6', true);
         });
     })->export('xls');
 }
Example #2
0
 public function getReport()
 {
     $input = Input::all();
     $periodo = explode(' - ', $input['periodo']);
     switch ($input['tipo']) {
         case 'atestados':
             OcorrenciaAtestado::relatorioAtestados();
             break;
         case 'ocorrencia':
             Ocorrencia::getRelatorioOperacoes();
             break;
         default:
             # code...
             break;
     }
 }