File "RegistrosAudi.php.bak"

Full Path: C:/wamp64/www/INVENTAPP/RegistrosAudi.php.bak
File size: 10.76 KB
MIME-type: text/x-php
Charset: utf-8

<?php
session_start();
header("Cache-control: private"); // Arregla IE 6

//*******Datos de Conexion Base de Datos************
include("conexion.php");
$FECHA = date("Y-m-d");

$USUARIO=$_SESSION['nomUser'];
$USUARIOA=$USUARIO."A";
//$USUARIOA="TAB02";
$UBICACION=$_SESSION['ubicacion'];
$DCTO=$_SESSION['dcto'];
$TKILOS = 0;
$TUNI = 0;
$TCANASTAS = 0;
$TBULTOS = 0;
$TCAJAS = 0;
$TBASES = 0;
$N = 0;
$D1 = "";
$D2 = "";
$D3 = "";

//***A TODAS LAS UBICACIONES 

//AAA => Consulta todas las ubicaciones todos los codigos y todos los planilladores 
//ABA => Consulta todas las ubicaciones según el producto
//AAB => Consulta todas las ubicaciones todos los productos segun digitador
//BAA => Consulta todas una ubicacion especial con todos los codigos y planilladores 






// Consulta SQL
$sql = "SELECT SUM(CANTIDAD) AS CANTIDAD, SUM(CANTEMPAQ) AS UNIDADES, SUM(CNASTAPLL) AS CANASTAS, SUM(CAJAS) AS CAJAS, SUM(BULTOS) AS BULTOS, SUM(BASES) AS BASES FROM mvdcto WHERE USUARIO='$USUARIO' AND TPDCTO='$DCTO' AND CODUBI='$UBICACION'";
$result = mysqli_query($conexion, $sql);
if ($result) {
    $row = mysqli_fetch_assoc($result);
    $cantidad = $row['CANTIDAD'];
    $unidades = $row['UNIDADES'];
    $canastas = $row['CANASTAS'];
    $cajas = $row['CAJAS'];
    $bultos = $row['BULTOS'];
    $bases = $row['BASES'];
} else {
    echo "Error en la consulta: " . mysqli_error($conexion);
}

// Consulta SQL
$sql1 = "SELECT SUM(CANTIDAD) AS CANTIDAD, SUM(CANTEMPAQ) AS UNIDADES, SUM(CNASTAPLL) AS CANASTAS, SUM(CAJAS) AS CAJAS, SUM(BULTOS) AS BULTOS, SUM(BASES) AS BASES FROM mvdcto WHERE USUARIO='$USUARIOA' AND TPDCTO='$DCTO' AND CODUBI='$UBICACION'";
$result1 = mysqli_query($conexion, $sql1);
if ($result1) {
    $row1 = mysqli_fetch_assoc($result1);
    $cantidad1 = $row1['CANTIDAD'];
    $unidades1 = $row1['UNIDADES'];
    $canastas1 = $row1['CANASTAS'];
    $cajas1 = $row1['CAJAS'];
    $bultos1 = $row1['BULTOS'];
    $bases1 = $row1['BASES'];
} else {
    $cantidad1 = 0;
    $unidades1 = 0;
    $canastas1 = 0;
    $cajas1 = 0;
    $bultos1 = 0;
    $bases1 = 0;
}


// Validaciones de acta

// Validaciones de acta

// Validaciones de acta
$ACANTIDAD = ($cantidad1 == $cantidad) ? "OK" : "ERROR";
$AUNIDADES = ($unidades1 == $unidades) ? "OK" : "ERROR";
$ACANASTAS = ($canastas1 == $canastas) ? "OK" : "ERROR";
$ACAJAS = ($cajas1 == $cajas) ? "OK" : "ERROR";
$ABULTOS = ($bultos1 == $bultos) ? "OK" : "ERROR";
$ABASES = ($bases1 == $bases) ? "OK" : "ERROR";

$_SESSION['ESTADO']=$ACANTIDAD.$AUNIDADES.$ACANASTAS.$ACAJAS.$ABASES;


?>


<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Acta de Registros Inventarios</title>
<link rel="icon" type="image/png" href="img/icon.png">
<style>
  body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #f8bc5a;
  }
  .container {
    width: 100%;
    max-width: 800px;
    margin: auto;
    padding: 20px;
    box-sizing: border-box;
    background-color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  }
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
  }
  th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
  }
  th {
    background-color: #4CAF50; /* Green */
    color: white;
  }
  td {
    background-color: #f9f9f9; /* Light grey */
    color: black; /* Black font color */
  }
  .header {
    background-color: #4CAF50; /* Green */
    color: white;
  }
  .totals {
    background-color: #4CAF50; /* Green */
    color: white;
  }
  .data {
    background-color: #f1f1f1; /* Lighter grey */
  }
  canvas {
    border: 1px solid #ddd;
    width: 100%;
  }
  .textbox {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  .vertical-fields {
    margin-bottom: 20px;
  }
  .logo {
    text-align: center;
    margin-bottom: 20px;
  }
  button {
    background-color: #4CAF50; /* Green */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }
  button:hover {
    background-color: #45a049;
  }
</style>
</head>
<body>
<div class="container">
  <div class="logo">
    <img src="logo.png" alt="avicampo Logo" width="200">
  </div>
  <form method="post" action="process_form.php">
    <center>
      <p><strong>Acta de Control de Registros Inventario General AVICAMPO PEREIRA</strong></p>
      <p>Fecha: <?php echo $FECHA; ?></p>
      <p>Consecutivo: <?php echo $DCTO; ?></p>
      <div class="vertical-fields">
        <p><label for="nombre_planillador">Nombre Planillador:</label>
        <input type="text" class="textbox" name="nombre_planillador" id="nombre_planillador"></p>
        
        <p><label for="nombre_auditor">Nombre Auditor:</label>
        <input type="text" class="textbox" name="nombre_auditor" id="nombre_auditor"></p>
        
        <p><label for="nombre_pesador">Nombre Pesador:</label>
        <input type="text" class="textbox" name="nombre_pesador" id="nombre_pesador"></p>
      </div>
      <table>
        <tr class="header">
          <th width="50%">Ubicación</th>
          <th width="28%">Usuario</th>
          <th width="22%">Usuario Audita</th>
        </tr>
        <tr>
         <td><?php echo $UBICACION; ?></td>
          <td><?php echo $USUARIO; ?></td>
          <td><?php echo $USUARIOA; ?></td>
        </tr>
      </table>
      <p><strong>Totales Registrador por el usuario Planillador</strong></p>
      <table>
        <tr class="data">
          <th>Reg</th>
          <th>Descripción Ubicación</th>
          <th>Kilos</th>
          <th>Unidades</th>
          <th>Canastas</th>
          <th>Cajas</th>
          <th>Bultos</th>
          <th>Bases</th>
        </tr>
        <tr class="totals">
          <td>1</td>
          <td align="right"><?PHP echo $UBICACION;?></td>
          <td align="right"><?PHP echo number_format($cantidad,2);?></td>
          <td align="right"><?PHP echo number_format($unidades,2);?></td>
          <td align="right"><?PHP echo number_format($canastas,2);?></td>
          <td align="right"><?PHP echo $cajas;?></td>
          <td align="right"><?PHP echo number_format($bultos,2);?></td>
          <td align="right"><?PHP echo number_format($bases,2);?></td>
        </tr>
      </table>
      <p><strong>Totales Registrados por el usuario Auditor</strong></p>
      <table>
        <tr class="data">
          <th>Reg</th>
          <th>Descripción Ubicación</th>
          <th>Kilos</th>
          <th>Unidades</th>
          <th>Canastas</th>
          <th>Cajas</th>
          <th>Bultos</th>
          <th>Bases</th>
        </tr>
        <?php
        // Aquí iría la lógica para llenar la tabla con los datos de la base de datos
        ?>
        <tr class="totals">
          <td>1</td>
          <td align="right"><?PHP echo $UBICACION;?></td>
          <td align="right"><?PHP echo number_format($cantidad1,2);?></td>
          <td align="right"><?PHP echo number_format($unidades1,2);?></td>
          <td align="right"><?PHP echo number_format($canastas1,2);?></td>
          <td align="right"><?PHP echo $cajas1;?></td>
          <td align="right"><?PHP echo number_format($bultos1,2);?></td>
          <td align="right"><?PHP echo number_format($bases1,2);?></td>
        </tr>
      </table>
      <p><strong>Resultado de la Auditoria</strong></p>
      <table>
        <tr class="data">
          <th>Reg</th>
          <th>Descripción Ubicación</th>
          <th>Kilos</th>
          <th>Unidades</th>
          <th>Canastas</th>
          <th>Cajas</th>
          <th>Bultos</th>
          <th>Bases</th>
        </tr>
        <?php
        // Aquí iría la lógica para llenar la tabla con los datos de la base de datos
        ?>
        <tr class="totals">
          <td>1</td>
          <td align="right"><?PHP echo $UBICACION;?></td>
          <td align="right"><?PHP echo $ACANTIDAD;?></td>
          <td align="right"><?PHP echo $AUNIDADES;?></td>
          <td align="right"><?PHP echo $ACANASTAS;?></td>
          <td align="right"><?PHP echo $ACAJAS;?></td>
          <td align="right"><?PHP echo $ABULTOS;?></td>
          <td align="right"><?PHP echo $ABASES;?></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <p><strong>Firma Planillador:</strong></p>
      <canvas id="signatureCanvasPlanillador" width="400" height="150"></canvas>
      <button type="button" onclick="clearCanvas('signatureCanvasPlanillador')">Limpiar</button>
      <input type="hidden" name="signaturePlanillador" id="signaturePlanillador">
      
      <p><strong>Firma Auditor:</strong></p>
      <canvas id="signatureCanvasAuditor" width="400" height="150"></canvas>
      <button type="button" onclick="clearCanvas('signatureCanvasAuditor')">Limpiar</button>
      <input type="hidden" name="signatureAuditor" id="signatureAuditor">
      
      <p><strong>Firma Pesador:</strong></p>
      <canvas id="signatureCanvasPesador" width="400" height="150"></canvas>
      <button type="button" onclick="clearCanvas('signatureCanvasPesador')">Limpiar</button>
      <input type="hidden" name="signaturePesador" id="signaturePesador">
      
      <button type="submit">Continuar</button>
    </center>
  </form>
</div>
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script>
<script>
  function initializeSignaturePad(canvasId, hiddenInputId) {
    var canvas = document.getElementById(canvasId);
    var signaturePad = new SignaturePad(canvas, {
      backgroundColor: 'rgba(255, 255, 255, 0)',
      penColor: 'black'
    });

    function resizeCanvas() {
      var ratio = Math.max(window.devicePixelRatio || 1, 1);
      canvas.width = canvas.offsetWidth * ratio;
      canvas.height = canvas.offsetHeight * ratio;
      canvas.getContext('2d').scale(ratio, ratio);
      signaturePad.clear(); // otherwise isEmpty() might return incorrect value
    }

    window.addEventListener('resize', resizeCanvas);
    resizeCanvas();

    canvas.addEventListener('mouseup', function() {
      document.getElementById(hiddenInputId).value = signaturePad.toDataURL();
    });
  }

  function clearCanvas(canvasId) {
    var canvas = document.getElementById(canvasId);
    var signaturePad = new SignaturePad(canvas);
    signaturePad.clear();
    document.getElementById(canvasId.replace('Canvas', '')).value = '';
  }

  initializeSignaturePad('signatureCanvasPlanillador', 'signaturePlanillador');
  initializeSignaturePad('signatureCanvasAuditor', 'signatureAuditor');
  initializeSignaturePad('signatureCanvasPesador', 'signaturePesador');
</script>
</body>
</html>