public function enviarAsignacionesA() { /*************/ if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } $data = array('idPeriodo' => Input::get('i')); $seleccionar = AsignacionesController::consultaGetAsignacionesActual(); if (count($seleccionar) > 0) { /* $correoInt = Integrantes::where('intActivo',TRUE) ->get(array( 'intCorreo' )) ->toArray(); $correoRes = Responsables::where('resActivo',TRUE) ->get(array( 'resCorreo' )) ->toArray(); foreach ($correoInt as $valor) { $toEmail[]= $valor['intCorreo']; } foreach ($correoRes as $valor) { $toEmail[]= $valor['resCorreo']; } */ $body = ''; $i = 1; foreach ($seleccionar as $valor) { $fuente = $valor['fueNombre']; $representante = $valor['resNombre']; $body = $body . '<tr>'; $body = $body . '<td>' . $i . '</td>'; $body = $body . '<td style="text-align: center">' . $fuente . '</td>'; $body = $body . '<td style="text-align: center">' . $representante . '</td>'; $body = $body . '</tr>'; $i++; $periodo = ""; $periodo = $periodo . $valor['perInicio'] . " a "; $periodo = $periodo . $valor['perFin']; } $titulo = "Asignación Actual"; $dataCorreo = array('titulo' => $titulo, 'periodo' => $periodo, 'body' => $body); $toEmail = "*****@*****.**"; Mail::send('emails.envioAsignacionesMail', $dataCorreo, function ($message) use($toEmail) { $message->to($toEmail); $message->subject('ASIGNACIONES DE FUENTES DE INFORMACIÓN.'); }); $response = array('status' => 'OK', 'message' => 'Se enviaron correos.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.'); } return Response::json($response); }
public function getAsignacionActual() { if (!Sesion::isResponsable()) { if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } } $seleccionar = AsignacionesController::consultaGetAsignacionesActual(); if (count($seleccionar) > 0) { $response = array('status' => 'OK', 'data' => $seleccionar, 'message' => 'Resultados obtenidos'); } else { $response = array('status' => 'ERROR', 'message' => 'No se encontraron fuentes registradas.'); } return Response::json($response); }
public static function imprimirAsignacionesA() { $seleccionar = AsignacionesController::consultaGetAsignacionesActual(); $cuerpoTabla = ''; $i = 0; $periodo = ""; foreach ($seleccionar as $value) { $i = $i + 1; $fuenombre = $value['fueNombre']; $resNombre = $value['resNombre']; $periodo = ""; $periodo = $periodo . $value['perInicio'] . " a "; $periodo = $periodo . $value['perFin']; $cuerpoTabla = $cuerpoTabla . '<tr> <td width="3%" > <div align="center"> <CODE style="font-size: 80%;">' . $i . '</code> </div> </td> <td> <div align="center"> <CODE>' . $fuenombre . '</code> </div> </td> <td> <div align="center"> <CODE>' . $resNombre . '</code> </div> </td> </tr>'; } $html = '<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><body>' . '<h5 align="right">Sistema de Noticias </h5><h5 align="right">Vázquez Hernández Contadores, S.C.</h5>' . '<h3 align="center">Asignación de fuentes de información</h3>' . '<p> <strong>Período: </strong> ' . $periodo . '</p>' . '<table cellspacing="0" border="1" align="center" width="400" > <tbody > <tr> <td width="3%" > <div align="center"> </div> </td> <td width="20%" > <div align="center"> <h5><strong>Fuente</strong> </h5> </div> </td> <td width="20%"> <div align="center"> <h5><strong>Responsable</strong> </h5> </div> </td> </tr>' . $cuerpoTabla . '</tbody </table>' . '</body></html>'; return PDF::load($html, 'letter', 'portrait')->show(); }