public function postValidarficha() { if (Request::ajax()) { $ficha = Input::get('ficha'); $reniec = Input::get('reniec'); $fichaId = Input::get('ficha_id'); $paternon = Input::get('paternon'); $maternon = Input::get('maternon'); $nombresn = Input::get('nombresn'); $paterno = Input::get('paterno'); $materno = Input::get('materno'); $nombres = Input::get('nombres'); $dni = Input::get('dni'); if ($reniec != '' && $fichaId != '') { $fichama = Ficha::find($fichaId); $fichama['usuario_updated_at'] = Auth::user()->id; $fichama['reniec_id'] = $reniec; $fichama['estado'] = 0; $fichama->save(); } $ef = EscalafonFichas::getEFIdporFicha($ficha); $efr = EscalafonFichas::getEFRIdporFicha($ficha); $ficham = new Ficha(); if ($reniec != '') { $ficham['reniec_id'] = $reniec; $ficham['dni'] = $dni; } if (count($ef) > 0) { $ficham['escalafon_ficha_id'] = $ef[0]->id; if (count($efr) > 0) { $ficham['escalafon_ficha_recepcion_id'] = $efr[0]->id; } } $estadoFicha = 0; //No existe dni if (strcasecmp($paternon, $paterno) != 0 or strcasecmp($maternon, $materno) != 0 or strcasecmp($nombresn, $nombres) != 0) { $estadoFicha = 2; // no existe asignación de entrega y recepción } elseif (strcasecmp($paternon, $paterno) == 0 and strcasecmp($maternon, $materno) == 0 and strcasecmp($nombresn, $nombres) == 0) { $estadoFicha = 1; // no existe asignación de recepción } $ficham['ficha'] = $ficha; $ficham['paterno'] = $paternon; $ficham['materno'] = $maternon; $ficham['nombres'] = $nombresn; $ficham['estado_ficha'] = $estadoFicha; $ficham['usuario_created_at'] = Auth::user()->id; $ficham->save(); if ($reniec != '') { $reniecm = Reniec::find($reniec); $reniecm['ficha_id'] = $ficham->id; $reniecm['usuario_updated_at'] = Auth::user()->id; $reniecm->save(); } $vef = Ficha::getValidarEstadoFicha($ficha); return Response::json(array('rst' => 1, 'msj' => 'Se registró la validación', 'estado' => $vef)); } }