예제 #1
0
function dateShort()
{
    $mes_actual = date("n");
    $mes = periodSchool()->month;
    if ($mes != $mes_actual) {
        $year = periodSchool()->year;
        $dia = date("d", mktime(0, 0, 0, $mes + 1, 1, $year) - 1);
        return $salida = "{$year}/{$mes}/{$dia}";
    }
    return date("Y/m/d");
}
예제 #2
0
 public function index()
 {
     set_time_limit(0);
     $student = $this->studentRepository->whereId('school_id', userSchool()->id, 'sex');
     $content = array(array(userSchool()->name), array('LISTA DE SALDOS DE ESTUDIANTES'), array(''));
     $countTotal = array();
     $countGrado = array();
     $countHeader = count($content);
     $school = $this->schoolsRepository->getModel()->find(userSchool()->id);
     foreach ($school->degrees as $degree) {
         $content[] = array('GRADO: ' . $degree->name);
         $countGrado[] = count($content);
         $content[] = array('CARNET', 'NOMBRE ALUMNO', 'SALDO');
         $students = $this->financialRecordsRepository->whereId('year', periodSchool()->year, 'updated_at');
         $total = 0;
         foreach ($students as $student) {
             if ($degree->id == $student->degreeDatos()->id) {
                 $content[] = array($student->students->book, $student->students->nameComplete(), $student->balance);
                 $total += $student->balance;
             }
         }
         $content[] = array('', 'TOTAL', $total);
         $countTotal[] = count($content);
         $content[] = array('', '', '');
     }
     Excel::create(date('d-m-Y') . '- Todos los Grados', function ($excel) use($content, $countTotal, $countGrado) {
         $excel->sheet('Saldos de todos los Alumnos', function ($sheet) use($content, $countTotal, $countGrado) {
             $sheet->mergeCells('A1:C1');
             $sheet->mergeCells('A2:C2');
             $sheet->mergeCells('A3:C3');
             foreach ($countGrado as $grado) {
                 $sheet->mergeCells('A' . $grado . ':C' . $grado);
                 $sheet->cells('A' . $grado . ':D' . $grado, function ($cells) {
                     $cells->setFontSize(12);
                     $cells->setFontWeight('bold');
                     $cells->setAlignment('center');
                 });
                 $grado = $grado + 1;
                 $sheet->cells('A' . $grado . ':D' . $grado, function ($cells) {
                     $cells->setFontSize(12);
                     $cells->setFontWeight('bold');
                     $cells->setAlignment('center');
                 });
             }
             foreach ($countTotal as $total) {
                 $sheet->cells('A' . $total . ':D' . $total, function ($cells) {
                     $cells->setFontSize(12);
                     $cells->setFontWeight('bold');
                     $cells->setAlignment('center');
                 });
             }
             $sheet->cell('A1', function ($cell) {
                 $cell->setFontSize(16);
                 $cell->setFontWeight('bold');
                 $cell->setAlignment('center');
             });
             $sheet->cell('A2', function ($cell) {
                 $cell->setFontSize(16);
                 $cell->setFontWeight('bold');
                 $cell->setAlignment('center');
             });
             $sheet->cell('A3', function ($cell) {
                 $cell->setFontSize(16);
                 $cell->setFontWeight('bold');
                 $cell->setAlignment('center');
             });
             $sheet->fromArray($content, null, 'A1', true, false);
         });
     })->export('xlsx');
 }