<?php
// Adapted from clinicademo _check_lote.php
// Path: _check_lote.php (AJAX — lot diagnostics)
// Adaptation: replaced InventoryLotData.php path to match laboratorio directory structure
require_once __DIR__ . '/core/controller/Database.php';
require_once __DIR__ . '/core/app/model/InventoryLotData.php';
$con = Database::getCon();

echo "=== Lote 289 ===\n";
$r = $con->query("SELECT id, inv_table, item_id, lot_number, comprobante, quantity FROM inventory_lot WHERE id = 289");
while ($row = $r->fetch_assoc()) { print_r($row); }

echo "\n=== Item 1 inventory_medication ===\n";
$r = $con->query("SELECT id, code, name, presentation FROM inventory_medication WHERE id = 1");
while ($row = $r->fetch_assoc()) { print_r($row); }

echo "\n=== Lotes con quantity > 0, item_id=1, inventory_medication ===\n";
$r = $con->query("SELECT id, lot_number, quantity, comprobante, fecha_vencimiento FROM inventory_lot WHERE quantity > 0 AND inv_table = 'inventory_medication' AND item_id = 1");
while ($row = $r->fetch_assoc()) { print_r($row); }
