<?php
require_once __DIR__ . '/../config.php';
$db = getDB();

// Ver columnas de transacciones relacionadas con skydropx
$stmt = $db->query("SHOW COLUMNS FROM transacciones LIKE '%skydropx%'");
$cols = $stmt->fetchAll();
echo "=== Columnas skydropx en transacciones ===\n";
foreach ($cols as $c) echo $c['Field'] . " (" . $c['Type'] . ")\n";

// Ver también tracking y carrier
$stmt2 = $db->query("SHOW COLUMNS FROM transacciones LIKE '%tracking%'");
$cols2 = $stmt2->fetchAll();
echo "\n=== Columnas tracking en transacciones ===\n";
foreach ($cols2 as $c) echo $c['Field'] . " (" . $c['Type'] . ")\n";

$stmt3 = $db->query("SHOW COLUMNS FROM transacciones LIKE '%carrier%'");
$cols3 = $stmt3->fetchAll();
echo "\n=== Columnas carrier en transacciones ===\n";
foreach ($cols3 as $c) echo $c['Field'] . " (" . $c['Type'] . ")\n";

// Ver la última transacción con cdentrega=8 para ver si tiene datos
$stmt4 = $db->query("SELECT idtransacciones, tipostr_idtipostr, skydropx_cotizacion_id, skydropx_rate_id, skydropx_order_id, skydropx_shipment_id, tracking_number, carrier FROM transacciones WHERE cdentrega=8 ORDER BY idtransacciones DESC LIMIT 3");
echo "\n=== Últimas 3 transacciones con cdentrega=8 ===\n";
foreach ($stmt4->fetchAll() as $r) {
    echo "ID:{$r['idtransacciones']} tipo:{$r['tipostr_idtipostr']} cotizacion:{$r['skydropx_cotizacion_id']} rate:{$r['skydropx_rate_id']} order:{$r['skydropx_order_id']} shipment:{$r['skydropx_shipment_id']} tracking:{$r['tracking_number']} carrier:{$r['carrier']}\n";
}
