public static function imprimirAsignaciones() { $idPeriodo = Input::get('ia'); $seleccionar = AsignacionesController::consultaGetAsignaciones($idPeriodo); $cuerpoTabla = ''; $i = 0; foreach ($seleccionar as $value) { $i = $i + 1; $fuenombre = $value['fueNombre']; $resNombre = $value['resNombre']; $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</h3>' . '<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(); }
public function getAsignaciones() { if (!Sesion::isResponsable()) { if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } } $data = array('idPeriodo' => Input::get('i')); // $seleccionar = DB::select('SELECT a.asiId, f.fueNombre, r.resNombre FROM fuentes f, responsables r, asignaciones a WHERE a.asiPeriodos='.$data['idPeriodo'].' AND a.asiResponsables = r.resId AND a.asiFuentes=fueId GROUP BY f.fueId;'); $seleccionar = AsignacionesController::consultaGetAsignaciones($data['idPeriodo']); if (count($seleccionar) > 0) { $response = array('status' => 'OK', 'data' => $seleccionar, 'message' => 'Resultados obtenidos'); } else { $response = array('status' => 'ERROR', 'message' => 'No se encontraron asignaciones para el período seleccionado, deberá crearla primero desde la opción de Agregar automáticamente.'); } return Response::json($response); }
public function enviarAsignaciones() { /************/ if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } $data = array('idPeriodo' => Input::get('i')); $seleccionar = AsignacionesController::consultaGetAsignaciones($data['idPeriodo']); 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++; } $dataCorreo = array('fuente' => "sdas", 'body' => $body); $toEmail = "*****@*****.**"; Mail::send('emails.envioAsignacionesMail', $dataCorreo, function ($message) use($toEmail) { $message->to($toEmail); $message->subject('ASIGNACIONES DE FUENTES.'); }); $response = array('status' => 'OK', 'message' => 'Se enviaron correos.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.'); } return Response::json($response); }