Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/10/2011, 08:01
jh0sz
 
Fecha de Ingreso: mayo-2010
Mensajes: 60
Antigüedad: 14 años
Puntos: 0
Respuesta: [Ayuda]Imprimir imagen en celda del fpdf

Amigos tendro otro inconveniente... Que es al finalizar la pagina me imprime la imagen fuera de la celda. Pueden ver el error en la siguiente imagen...

[URL=http://imageshack.us/photo/my-images/842/errrorfdpf.jpg/][IMG]http://img842.imageshack.us/img842/7210/errrorfdpf.jpg[/IMG][/URL]

Aca el código del reporte en fpdf

Código:
<?php
include('config_reportes.php');
include('fpdf.php');
include('../../menu_sistemas/lib/common.php');

class PDF extends FPDF {
    public $title;
    public $conexion;
    public $datosgenerales;
    public $array_compra;
	
    function Header() {
		$this->SetY(15);
        $width = 10;

        $this->Image('../imagenes/logo_gps.png',10,5,30);


        $this->SetY(5);
        $this->SetFont('Arial','',6);
        //$this->SetFillColor(239,239,239);
        $this->SetFont('Arial','B',6);
        $this->Cell(0,0, utf8_decode($this->datosgenerales[0]["nombre_empresa"]),0,0,'C');
        $this->Ln(3);
        $this->Cell(0,0, utf8_decode($this->datosgenerales[0]["direccion"]),0,0,'C');
        $this->Ln(3);
        $this->Cell(0,0, "Telefonos: ".$this->datosgenerales[0]["telefonos"] ,0,0,'C');
        $this->Ln(3);
        $this->Cell(0,0, "RIF ".utf8_decode($this->datosgenerales[0]["rif"]),0,0,'C');
		
        $this->Cell(0,0, utf8_decode("Fecha de Creación: ".fecha($this->array_compra[0]["fechacompra"])),0,0,'R');
        $this->Ln(3);
  

        $this->SetFont('Arial','',8);
        $this->Cell(0,0, utf8_decode("Nro. Cotización: ".$this->array_compra[0]["cod_compra"]),0,0,'R');
        $this->Ln(12);
        $this->SetX(10);
        $this->SetFont('Arial','',6);
	
        $this->Cell(0,0, "Proveedor: ".utf8_decode($this->array_compra[0]["nproveedor"]),0,0,'L');
        $this->Ln(3);
        $this->SetX(10);
        $this->Cell(0,0, utf8_decode("Dirección: ".$this->array_compra[0]["direccionproveedor"]),0,0,'L');
        $this->Ln(3);
        $this->SetX(10);
        $this->Cell(0,0, utf8_decode("Telefonos: ".$this->array_compra[0]["telefonosproveedor"]),0,0,'L');
        $this->Ln(6);

       /* $this->SetX(10);
        $this->Cell(0,0, utf8_decode($this->datosgenerales[0]["id_fiscal2"].": ".$this->array_compra[0]["nitproveedor"]),0,0,'L');
        $this->Ln(3);
	  */
	   $this->Ln(3);
        /*$this->SetX(10);
        $this->Cell(0,0, utf8_decode("Reponsable: ".$this->array_compra[0]["responsable"]),0,0,'L');
        $this->Ln(3);
*/
       /* $this->SetX(14);
        $this->Cell(0,0, utf8_decode("Fac. Nro de Compra: ".$this->array_compra[0]["num_factura_compra"]),0,0,'L');
        $this->Ln(3);
	*/
        $this->SetX(14);
        $this->SetFont('Arial','B',12);
        $this->Cell(0,0, utf8_decode("COTIZACIÓN"),0,0,'C');
        $this->Ln(6);

        


        $this->SetLeftMargin(50);
        $width = 5;
        $this->SetX(10);
        $this->SetFont('Arial','',6);
		
		
        $this->SetFillColor(10,10,10,10,10,10,10,10,10);
        $this->Cell(11,$width,'Codigo',1,0,"C",0);
        $this->Cell(60,$width,utf8_decode('Descripción'),1,0,"C",0);
		 $this->Cell(30,$width,utf8_decode('Imagen'),1,0,"C",0);
        $this->Cell(11,$width,utf8_decode('Cantidad'),1,0,"C",0);
        $this->Cell(15,$width,utf8_decode('Precio'),1,0,"C",0);
        //$this->Cell(20,$width,utf8_decode('Almacen'),1,0,"C",0);
        $this->Cell(15,$width,utf8_decode('I.V.A'),1,0,"C",0);
        $this->Cell(20,$width,utf8_decode('Total Sin I.V.A'),1,0,"R",0);
        $this->Cell(11,$width,utf8_decode('% I.V.A'),1,0,"R",0);
        $this->Cell(20,$width,utf8_decode('Total con I.V.A'),1,0,"R",0);
        $this->Ln(5);


    }

    function Footer() {
        $this->SetY(-15);
		$this->SetX(10);
        $this->SetFont('Arial','I',10);

        $this->Cell(0,10,utf8_decode('Página ').$this->PageNo(),0,0,'C');
    }

    function dwawCell($title,$data) {
        $width = 8;
        $this->SetFont('Arial','B',12);
        $y =  $this->getY() * 20;
        $x =  $this->getX();
        $this->SetFillColor(206,230,100);
        $this->MultiCell(175,8,$title,0,1,'L',0);
        $this->SetY($y);
        $this->SetFont('Arial','',12);
        $this->SetFillColor(206,230,172);
        $w=$this->GetStringWidth($title)+3;
        $this->SetX($x+$w);
        $this->SetFillColor(206,230,172);
        $this->MultiCell(175,8,$data,0,1,'J',0);

    }


    function ChapterBody() {



        //$conn = new rp_Connect();
        //$conn->SQL("select * from esquema.almacen_ubicacion");





        $this->SetWidths(array(11,60,30,11,15,15,20,11,20));
		
        $this->SetAligns(array("C","J","C","C","C","R","R","R","R"));
        $this->SetFillColor(232,232,232,232,232,232,232,232,232);
        $cantidaditems = $this->array_compra[0]["cantidad_items"];

        $subtotal = 0;
        for($i=0;$i<$cantidaditems;$i++) {
            $this->SetLeftMargin(30);
            $width = 5;
            $this->SetX(10);
			//this->getY() ;
			//$this->SetY($y);
            $this->SetFont('Arial','',6);
			$imagen = '../imagenes/'.$this->array_compra[$i]["foto"];
            $subtotal += $this->array_compra[$i]["_item_cantidad"]*$this->array_compra[$i]["_item_preciosiniva"];
			
            $this->Row(
			
                    array(  $this->array_compra[$i]["cod_item"],
                    utf8_decode($this->array_compra[$i]["descripcion1"]),
					//$this->Cell( 1, 1, $this->Image('../imagenes/'.$this->array_compra[$i]["foto"],90,$this->GetY(),'LR',0,null,null), 0, 0, 'L', false ),
					//$this->Cell(16,16,$this->Image($imagen,90,$this->GetY(),16,16)),
					$this->Image($imagen,90,$this->GetY(),16,16,null,null),
                    $this->array_compra[$i]["_item_cantidad"],
                    number_format($this->array_compra[$i]["_item_preciosiniva"], 2, ',', '.')." ".$this->datosgenerales[0]["moneda"],
                    //$this->array_compra[$i]["descripcion"],
                    number_format($this->array_compra[$i]["_tiva"], 2, ',', '.')." ".$this->datosgenerales[0]["moneda"],
                    number_format($this->array_compra[$i]["_item_totalsiniva"], 2, ',', '.')." ".$this->datosgenerales[0]["moneda"],
                    number_format($this->array_compra[$i]["piva"], 2, ',', '.')." %",
                    number_format($this->array_compra[$i]["_item_totalconiva"], 2, ',', '.')." ".$this->datosgenerales[0]["moneda"]),1);

        }

        $this->Ln(2);
        //$this->SetLeftMargin(50);
        $width = 5;
        $this->SetX(168);
        $this->SetFont('Arial','',6);
        $this->Cell(15,$width,utf8_decode('Sub-Total'),1,0,"R",0);
        $this->Cell(20,$width,number_format($subtotal, 2, ',', '.')." ".$this->datosgenerales[0]["moneda"],1,0,"R",0);
        $this->Ln(5);
        $this->SetX(168);
        $this->Cell(15,$width,utf8_decode('I.V.A'),1,0,"R",0);
        $this->Cell(20,$width,number_format($this->array_compra[0]["ivaTotalcompra"], 2, ',', '.')." ".$this->datosgenerales[0]["moneda"],1,0,"R",0);
        $this->Ln(5);
        $this->SetX(168);
        $this->Cell(15,$width,utf8_decode('Total'),1,0,"R",0);
        $this->Cell(20,$width,number_format($this->array_compra[0]["TotalTotalcompra"], 2, ',', '.')." ".$this->datosgenerales[0]["moneda"],1,0,"R",0);
        $this->Ln(5);



    }

    function ChapterTitle($num,$label) {
        $this->SetFont('Arial','',10);
        $this->SetFillColor(200,220,255);
        $this->Cell(0,6,"$label",0,1,'L',1);
        $this->Ln(8);
    }

    function SetTitle($title) {
        $this->title   = $title;
    }

    function PrintChapter() {

        $this->AddPage();

        $this->ChapterBody();
    }

    function DatosGenerales($array) {

		$this->Cell(10,10,"$label",0,1,'L',1,true);
        $this->datosgenerales = $array;
		$this->getY() * 40;
	    $this->SetY($y);
		;
    }

    function Arraycompra($array) {
        $this->array_compra = $array;
    }


}


$nro_compra = @$_GET["codigo"];
$comunes = new ConexionComun();

$array_parametros_generales = $comunes->ObtenerFilasBySqlSelect("select * from parametros_generales");

$array_compra =   $comunes->ObtenerFilasBySqlSelect("
SELECT *, p.descripcion as nproveedor,
p.direccion as direccionproveedor,
p.telefonos as telefonosproveedor,
p.nit as nitproveedor
from  compra c  inner join compra_detalle cd on cd.id_compra = c.id_compra
    inner join proveedores p on p.id_proveedor = c.id_proveedor
    left join almacen a on a.cod_almacen = cd._item_almacen inner join
    item i on i.id_item = cd.id_item
    where c.cod_compra = '".$nro_compra."'");




if(count($array_compra)==0){
    echo "no se encontraron registros.";
    exit;
}

$pdf=new PDF('L','mm','letter');
$title='Detalle de Cotizacion';
$pdf->DatosGenerales($array_parametros_generales);
$pdf->Arraycompra($array_compra);

$pdf->SetTitle($title);
$pdf->PrintChapter();
$pdf->SetDisplayMode('default');
$pdf->Output();

?>