<?php



require('/home/sistemastock/public_html/pdf/html2pdf.php');



include 'concha.php';

mysql_connect("$host","$usuario","$contra");

mysql_select_db ("$basedatos");



$sql = "SELECT * FROM `configuracion` LIMIT 1";

$consulta = mysql_query ($sql);

while ($row = mysql_fetch_array($consulta))

{


$nombre_kiosco = utf8_decode($row["nombre_kiosco"]);

}

mysql_free_result($consulta);


$d = date(d);
$m = date(m);
$a = date(Y);

$texto ="<b>$nombre_kiosco</b><br> ------------------<br> $d / $m / $a <br>------------------ <br><br><br>------------------ <br>";






$ID_venta = (int)$_GET['ID'];

$total = 0;




mysql_connect("$host","$usuario","$contra");


mysql_select_db ("$basedatos");



$sql = "SELECT * FROM `movimientos` WHERE `ID_venta` = '$ID_venta'";



$consulta = mysql_query ($sql);


while ($row = mysql_fetch_array($consulta))


{


$ID_articulo = $row["ID_articulo"];

$precio = $row["precio"];

$cantidad = $row["cantidad"];

$detalle = $row["detalle"];

if ($multicaja == 1) { mysql_select_db ("$basedatos_multicaja"); };

$sql22 = "SELECT * FROM `articulos` WHERE `ID` = '$ID_articulo' LIMIT 1";


$consulta22 = mysql_query ($sql22);


while ($row22 = mysql_fetch_array($consulta22))


{


$ID_producto = $row22["ID"];

$titulo = $row22["titulo"];

$foto = $row22["foto"];

}


mysql_free_result($consulta22);

if ($multicaja == 1) { mysql_select_db ("$basedatos"); };

if ($cantidad <= 1) { 


}

else {

$precio = $precio * $cantidad;

};





$total = $total + $precio;


 if($ID_articulo == 0) {$texto .=  $detalle; } else { $texto .= $titulo; }; 

$texto .= "<span style=font-size:9px>(x $cantidad )</span> = <b>$ $precio</b><hr>";

 $texto .= "<br>-------------------<br>";


}


mysql_free_result($consulta);







$texto .= "<br><br>";
//$acorde = htmlentities($acorde);
$texto .= "TOTAL: <b>$ $total</b><br>";





    $pdf=new PDF_HTML();
    $pdf->SetFont('courier','',11);
    $pdf->AddPage();
    
    
    
    
    
    
    
    $pdf->WriteHTML($texto);
    $pdf->Output("$todo.pdf",'I');
    
    
   
    exit;

?>