<?php
require('fpdf.php');
require('rotation.php');
include ("../conexion.php"); 

class PDF extends PDF_Rotate
{
function RotatedText($x,$y,$txt,$angle)
{
	//Text rotated around its origin
	$this->Rotate($angle,$x,$y);
	$this->Text($x,$y,$txt);
	$this->Rotate(0);
}

function RotatedImage($file,$x,$y,$w,$h,$angle)
{
	//Image rotated around its upper-left corner
	$this->Rotate($angle,$x,$y);
	$this->Image($file,$x,$y,$w,$h);
	$this->Rotate(0);
}
}





$pdf=new PDF('L','mm',array(30,80));



$sel_lineas="SELECT * FROM habladores  WHERE chkhab=1  ORDER BY dscart ASC";
//$rs_lineas=mysql_query($sel_lineas);         //  seleciona las lineas de la tabla de compras 

if ($resultado = $mysqli->query($sel_lineas)) 
while ($fila = $resultado->fetch_assoc()) {
//for ($i = 0; $i < mysql_num_rows($rs_lineas); $i++) {
	$cdgbar    = $fila["CDGBAR"];
	$dscart    = $fila["DSCART"];
	$pre001    = $fila["PRE001"];
	$pre001=number_format($pre001,2);
	
	

$pdf->AddPage();

	$pdf->SetFillColor(255,255,255);	
    $pdf->SetTextColor(11,4,4);
    $pdf->SetDrawColor(0,0,0);
    $pdf->SetLineWidth(.2);
	
    $pdf->SetFont('Arial','B',26);	
	$pdf->SetY(2);	
	$pdf->Ln(2);
	$pdf->Cell(1);
	$pdf->RotatedText(43,8,$pre001,360);

    $pdf->SetFont('Arial','B',13);	
	$pdf->SetY(3);	
	$pdf->Ln(4);
	$pdf->Cell(0);
	$pdf->RotatedText(70,22,$dscart,360);
	
	
	    $pdf->SetFont('Arial','B',14);	
	$pdf->SetY(3);	
	$pdf->Ln(4);
	$pdf->Cell(0);
	$pdf->RotatedText(70,10,'PRECIO ',360);
	
		    $pdf->SetFont('Arial','B',20);	
	$pdf->SetY(3);	
	$pdf->Ln(4);
	$pdf->Cell(40);
	$pdf->RotatedText(50,10,'¢',360);
  

  ///  $pdf->SetFont('Arial','B',13);	
	//$pdf->SetY(4);	
	//$pdf->Ln(3);
	//$pdf->Cell(6);

  //  $pdf->Code39(50,5,$cdgbar,0.5,10);




}




//$pdf->RotatedImage('circle.png',85,60,40,16,45);
$pdf->Output('barras.pdf','F');
$pdf->Output();
?>
