Example #1
0
 public function DifuntoNicho($nichoid)
 {
     $TN = TotalNicho::where('GC_NICHOS_id', $nichoid)->get();
     if (count($TN) > 0) {
         $total = $TN[0]->total;
         $fecha = $TN[0]->ultimo;
         $fecha_ultimo = new Carbon($fecha);
         $fecha_ultimo->addYears(4);
         $hoy = Carbon::now();
         $cumpletotal = true;
         if ($total >= 4) {
             $cumpletotal = false;
         }
         $cumplefecha = true;
         if ($fecha_ultimo > $hoy) {
             $cumplefecha = false;
         }
         return view('alta_difunto', compact('nichoid', 'total', 'fecha', 'cumpletotal', 'cumplefecha'));
     }
     return view('alta_difunto', compact('nichoid'));
 }
Example #2
0
 public function getData(Request $request)
 {
     $nichoid = $request->input('id');
     $TN = TotalNicho::where('GC_NICHOS_id', $nichoid)->get();
     $total = 0;
     $fecha = 0;
     $cumplefecha = true;
     $cumpletotal = true;
     if (count($TN) > 0) {
         $total = $TN[0]->total;
         $fecha = $TN[0]->ultimo;
         $fecha_ultimo = new Carbon($fecha);
         $fecha_ultimo->addYears(5);
         $hoy = Carbon::now();
         $cumpletotal = true;
         if ($total >= 4) {
             $cumpletotal = false;
         }
         $cumplefecha = true;
         if ($fecha_ultimo > $hoy) {
             $cumplefecha = false;
         }
     }
     $data['total'] = $total;
     $data['fecha'] = $fecha;
     $data['cumpletotal'] = $cumpletotal;
     $data['cumplefecha'] = $cumplefecha;
     return json_encode($data);
 }