 <?php

$_SESSION['database'] = $_GET['database'];

$_SESSION['codigo'] = $_GET['codigo'];

$_SESSION['costo'] = '0';
$_SESSION['precio1'] = '0';
$_SESSION['precio6'] = '0';

$_SESSION['itbm'] = '0';
$_SESSION['familia'] = '0';

include 'conn.php';
include 'funciones.php';

$montoesql = "select productos_det.pr_id,pr_costo_prom,productos_det.pr_venta1,pr_venta6,productos_det.pr_itbms,productos.pr_id_familia from " . $_SESSION['database'] . ".productos_det

left outer join productos on productos_det.pr_id=productos.pr_id where productos_det.pr_id='" . $_SESSION['codigo'] . "' limit 1";

logs($montoesql);

$qur = $connection->query($montoesql);

while ($r = mysqli_fetch_assoc($qur)) {

    $_SESSION['costo'] = $r['pr_costo_prom'];
    $_SESSION['precio1'] = $r['pr_venta1'];
    $_SESSION['precio6'] = $r['pr_venta6'];
    $_SESSION['itbm'] = $r['pr_itbms'];
    $_SESSION['familia'] = $r['pr_id_familia'];
}

echo $_SESSION['codigo'] . "@" . $_SESSION['costo'] . "@" . $_SESSION['precio1'] . "@" . $_SESSION['precio6'] . "@" . $_SESSION['itbm'] . "@" . $_SESSION['familia'];

@mysqli_close($connection);
?>