public function Modificacion() { $dataHeader = array('' => ''); $dataFooter = array('' => ''); $dataHeader['user'] = $_SESSION['username']; $data = array('area' => '', 'error' => ''); $result = $this->model->getRow('Location', '*', ' ', $this->ok); if ($result != false && $result->num_rows > 0) { while ($Area = $result->fetch_assoc()) { $data['area'] .= "<option value='{$Area['id_location']}'> {$Area['location_name']} </option >"; } } //var_dump($_POST['estatus']); if (isset($_POST['procesar']) && isset($_POST['estatus']) && $_POST['estatus'] != 'process') { $band = 0; if (!isset($_POST['idvehiculo'])) { $data['error'] .= "Necesita escojer un vehiculo para procesar la solicitud"; $band = 1; } if (!isset($_POST['area'])) { $data['error'] .= "No se selecciono ninguna área"; $band = 1; } if ($band == 0 && isset($_GET['idV']) && $_GET['idV'] != 0 && ($_POST['estatus'] == 'CONCLUIDO' || $_POST['estatus'] == 'affected')) { $estado = $this->model->UpdateEstado($_GET['idV'], 'affected', $this->ok); if ($estado != false) { //echo "here"; $campos = 'movement,inv_date,service,`service_ destination`,observations,status,id_vehicle,id_user'; $hoy = getdate(); $data['FechaEmision'] = $hoy['year'] . '-' . $hoy['mon'] . '-' . $hoy['mday']; $data['hora'] = $hoy['hours'] . ':' . $hoy['minutes'] . ':' . $hoy['seconds']; $fecha = $data['FechaEmision'] . " " . $data['hora']; $rsultV = $this->model->getRow('Vehicle', '*', "WHERE vin LIKE '%{$_POST['idvehiculo']}%'", $this->ok); if ($rsultV != false && $rsultV->num_rows > 0) { //echo "here"; $Vehiculo = $rsultV->fetch_assoc(); $values = "'in','{$data['FechaEmision']}','Inspeccion','{$_POST['area']}','Entrada de inspeccion','slope',{$Vehiculo['id_vehicle']},{$_SESSION['user']}"; $resultInv = $this->model->Inset('Inventory', $campos, $values, $this->ok); if ($resultInv != false) { header("Location: ?ctrl=inspeccion&M"); } else { $data['error'] = $this->ok['error']; } } } } elseif (isset($_GET['idV']) && $_GET['idV'] != 0 && $_POST['estatus'] == 'CANCELAR') { $estado = $this->model->UpdateEstado($_GET['idV'], 'cancel', $this->ok); $usrCancelar = $this->model->UpdateUsrCancelar($_GET['idV'], 1, $this->ok); if ($estado != false && $usrCancelar != false) { header("Location: ?ctrl=inspeccion"); } else { $data['error'] = $this->ok['error']; //var_dump($data['error']); } } } if (isset($_GET['idV']) && $_GET['idV'] != 0) { $Inspeccion = new InspeccionCtrl(); $Inspeccion->getInspeccionModificar($data, $_GET['idV']); echo getFile('header', $dataHeader) . getFile('Inspeccion/Modinspeccion', $data) . getFile('footer', $dataFooter); } }
public function Modificacion() { $dataHeader = array('' => ''); $dataFooter = array('' => ''); $data = array('area' => '', 'error' => ''); $result = $this->model->getRow('Area', '*', ' ', $this->ok); if ($result != false && $result->num_rows > 0) { foreach ($result as $key => $Area) { $data['area'] .= "<option value='{$Area['idarea']}'> {$Area['nombre']} </option >"; } } if (isset($_POST['procesar']) && isset($_POST['estatus']) && $_POST['estatus'] != 'ENPROCESO') { $band = 0; if (isset($_POST['idvehiculo']) && $_POST['idvehiculo'] != 0) { var_dump($_POST['idvehiculo']); } else { $data['error'] .= "Necesita escojer un vehiculo para procesar la solicitud"; $band = 1; } if (!isset($_POST['area'])) { $data['error'] .= "No se selecciono ninguna área"; $band = 1; } if ($band == 0 && isset($_GET['idV']) && $_GET['idV'] != 0 && $_POST['estatus'] == 'CONCLUIDO') { $estado = $this->model->UpdateEstado($_GET['idV'], 'AFECTADO', $this->ok); if ($estado != false) { $upvehiculo = $this->model->UpdateVehiculo($_GET['idV'], $_POST['idvehiculo'], $this->ok); if ($upvehiculo != false) { $campos = 'mov,fechaemision,area,areaDestino,observaciones,estatus,hora,usr_id,idvehiculo'; $hoy = getdate(); $data['FechaEmision'] = $hoy['year'] . '-' . $hoy['mon'] . '-' . $hoy['mday']; $data['hora'] = $hoy['hours'] . ':' . $hoy['minutes'] . ':' . $hoy['seconds']; $values = "'Entrada','{$data['FechaEmision']}','inspeccion','{$_POST['area']}','Entrada de inspeccion','PENDIENTE','{$data['hora']}',25, {$_POST['idvehiculo']}"; $resultInv = $this->model->Inset('inv', $campos, $values); if ($resultInv != false) { header("Location: ?ctrl=inspeccion"); } } } } elseif (isset($_GET['idV']) && $_GET['idV'] != 0 && $_POST['estatus'] == 'CANCELAR') { $estado = $this->model->UpdateEstado($_GET['idV'], 'CANCELADO', $this->ok); $usrCancelar = $this->model->UpdateUsrCancelar($_GET['idV'], 25, $this->ok); if ($estado != false && $usrCancelar != false) { header("Location: ?ctrl=inspeccion"); } } } if (isset($_GET['idV']) && $_GET['idV'] != 0) { $Inspeccion = new InspeccionCtrl(); $Inspeccion->getInspeccionModificar($data, $_GET['idV']); echo $Inspeccion->getFile('header', $dataHeader) . $Inspeccion->getFile('Inspeccion/Modinspeccion', $data) . $Inspeccion->getFile('footer', $dataFooter); } }