PHP - visualizar registros en pdf

 
Vista:
sin imagen de perfil

visualizar registros en pdf

Publicado por carlos Mario (18 intervenciones) el 02/11/2015 19:18:03
Hoa amigos despues de 3 dias de quebrarme la cabeza solicito su apoyo para finalizar este escrip.

Tengo dos tablas una de cotizacion y otra de detalles enlazadas en una relacion de uno a muchos.

Lo que quiero es poder visualizar el titulo de la cotizacion y listar sus detalles. las consultas estan ben pero he podido hacer visible los detalles en pdf . pongo el código.

Consultas probadas

1
2
3
4
5
6
7
8
9
10
11
12
13
if (mysql_num_rows($rs)>0){
    while($rw = mysql_fetch_array($rs)){
 
     echo "SELECT d.detalle FROM detcotizacion d, tblcotizacion co where d.tblcotizacion_idtblcotizacion= co.idtblcotizacion and co.visible='SI' and d.tblcotizacion_idtblcotizacion='$rw[3]'  and co.tblcotimaestro_idtblcotimaestro ='$idoc'";
         $datos[] = $rw;
 
        $det=mysql_query("SELECT d.detalle FROM detcotizacion d, tblcotizacion co where d.tblcotizacion_idtblcotizacion= co.idtblcotizacion and co.visible='SI' and d.tblcotizacion_idtblcotizacion='$row[3]'  and co.tblcotimaestro_idtblcotimaestro ='$idoc'");
 
        while($detalle=  mysql_fetch_array($det)){
             $detalles[]=$detalle;
         }
        }
        }

Aqui el codigo de la tabla donde puedo observar muy bien los títulos pero no los detalles

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function tabla($datos,$header,$idoc,$otr, $detalles)
{
 
    $w = array(15,120,25,24);
        $num_headers = count($header);
        for($i = 0; $i < $num_headers; ++$i) {
            $this->setfont('','B',12);
            $this->SetFillColor(224, 235, 255);
            $this->Cell($w[$i], 7, $header[$i], 1, 0, 'C','1');
        }
        $this->Ln();
        $this->SetFillColor(224, 235, 255);
        $this->SetTextColor(0);
        $this->setfont('','I',9);
        // Data
        $fill = 0;
 
    foreach($datos as $row)
   {
     $ancho=80;
        $altura=10;
 
    $this->Cell(15,$altura,''.$row['0'],1,'','C',$fill);
    $this->MultiCell(120,$altura,''.$row['1'],1,'L',$fill,'');
    $this->Cell(25,$altura,'',1,'','C',$fill);
    $this->Cell(24,$altura,''.number_format($row['2']),1,'','C',$fill);
    $this->Ln();
       $fill=!fill;
       $iva=$iva+$row['5'];
   // Bucle para ver los detalles de la cotizacion
   foreach($detalles as $det)
   {
        $ancho=80;
        $altura=10;
 
        $this->Cell(15,$altura,'',1,'','C',$fill);
        $this->MultiCell(120,$altura,''.$det['0'],1,'L',$fill,'');
        $this->Cell(25,$altura,'',1,'','C',$fill);
        $this->Cell(24,$altura,'',1,'','C',$fill);
 
            $this->Ln();
            $fill=!fill;
 
   }
   }
   $this->Ln(10);
   $this->setfont('','I',9);
   $this->setx(20);
 
//$this->Ln(10);
$this->setx(110);
$this->Cell(40,5,'IVA (%)  '.$otr['9']*100,0,'0','C');
$this->setx(140);
$this->Cell(40,5,'$ '.number_format($iva),1,'1','C');
$this->setx(140);
$this->setfont('','B',12);
$this->Cell(40,10,'TOTAL: $'.number_format ($otr['0']),1,'1','C','1');
$this->setx(20);
$this->setfont('','I',9);
$this->Cell(40,10,'Elaborada por : '.$emp['0'].' '.$emp['1'],0,2,'L');
$this->Cell(40,10,'fecha: '.$otr['6'],0,'1','L');


Agradezco su ayuda!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder