File "FOR-S-CCI-67.php"

Full Path: C:/wamp64/www/CALIDADWEB/CALIDADWEB/BACKEND/controller/FOR-S-CCI-67.php
File size: 3.19 KB
MIME-type: text/x-php
Charset: utf-8

<?php 
// 1. ELIMINA CUALQUIER ESPACIO O SALTO DE LÍNEA ANTES DE ESTA LÍNEA
// 2. Asegúrate de que session_start() se llama aquí o en un archivo incluido.
if (session_status() !== PHP_SESSION_ACTIVE) { session_start(); }
// ... el resto de tu código de includes y errores ...

require_once "../conexiones/BD.php";


// Habilitar errores de PDO para debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);
$bdc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//----------Control de cloro residual puntos de desinfección evisceración--------------------------------------------------------------

if (isset($_POST["formcontrolDesinfecEvisceracion"])) {
  // Recibir los datos del formulario
  $horaInicioEvisceracion = $_POST["horaInicioEvisceracion"] ?? null;
  $Evisceracion = $_POST["Evisceracion"] ?? null;
  $colgadoEvisceracion = $_POST["colgadoEvisceracion"] ?? null;
  $abdomen1Evisceracion = $_POST["abdomen1Evisceracion"] ?? null;
  $abdomen2Evisceracion = $_POST["abdomen2Evisceracion"] ?? null;
  $recuperacionEvisceracion = $_POST["recuperacionEvisceracion"] ?? null;
  $DScolgadoEvisceracion = $_POST["DScolgadoEvisceracion"] ?? null;
  $higadoEvisceracion = $_POST["higadoEvisceracion"] ?? null;
  $DCtoleranciaEvisceracion = $_POST["DCtoleranciaEvisceracion"] ?? null;
  $DStoleranciaEvisceracion = $_POST["DStoleranciaEvisceracion"] ?? null;
  $controlCorrectivoEvisceracion = $_POST["controlCorrectivoEvisceracion"] ?? null;
  $controlVerificoEvisceracion = $_POST["controlVerificoEvisceracion"] ?? null;
  $controlAproboEvisceracion = $_POST["controlAproboEvisceracion"] ?? null;

  try {
    $consult = "INSERT INTO `for-s-cci-67_desinfeccion_evisceracion` 
                    (`fecha`, `HoraFin`, `HoraInicio`, `evisceracion`, `colgado`, `abdomen1`, `abdomen2`, `recuperacion`, `dsColgado`, `higado`, `dcTolerancia`, `dsTolerancia`, `correctivo`, `verifico`, `aprobo`) 
                    VALUES 
                    (CURRENT_DATE(), NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

    $InspeccionC = $bdc->prepare($consult);
    $InspeccionC->execute([
      $horaInicioEvisceracion,
      $Evisceracion,
      $colgadoEvisceracion,
      $abdomen1Evisceracion,
      $abdomen2Evisceracion,
      $recuperacionEvisceracion,
      $DScolgadoEvisceracion,
      $higadoEvisceracion,
      $DCtoleranciaEvisceracion,
      $DStoleranciaEvisceracion,
      $colgadoEvisceracion,
      $controlVerificoEvisceracion,
      $controlAproboEvisceracion,
    ]);

    if ($InspeccionC->rowCount() > 0) {
      $_SESSION["mensaje"] =
        "Registro Cloro residual puntos desinfeccion Evisceracion realizado con éxito!";
      $_SESSION["tipo"] = "success";
      $_SESSION["icon"] = "check-circle-fill";
    } else {
      $_SESSION["mensaje"] = "No se insertaron datos en la base de datos.";
      $_SESSION["tipo"] = "danger";
      $_SESSION["icon"] = "exclamation-triangle-fill";
    }
  } catch (PDOException $e) {
    $_SESSION["mensaje"] = "Error al insertar datos: " . $e->getMessage();
    $_SESSION["tipo"] = "danger";
    $_SESSION["icon"] = "exclamation-triangle-fill";
  }header('Location: ../../FRONTED/HTML/FOR-S-CCI-67.php');
    exit;
}
?>