<?php
session_start();
require('../fpdf/fpdf.php');
require('plantilla_general.php');
require '../../../conexion.php';
require_once('../../../include/sesiones.php');

$query=mysqli_query($con,"SELECT * FROM combos where empresa='$empresa' ORDER BY com_nombre ASC ");

$pdf=new PDF_MC_Table();
$pdf->AddPage();
$pdf->SetFont('Arial','',14);
$pdf->AliasNbPages();
//Table with 20 rows and 4 columns

$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','B',8);
$pdf->Cell(30,6,'REF',1,0,'C',1);
$pdf->Cell(120,6,'NOMBRE',1,0,'C',1);
$pdf->Cell(30,6,'PRECIO',1,0,'C',1);
$pdf->Ln();  

$pdf->SetFont('Arial','',7);
    
 while ($roww=mysqli_fetch_array($query))   
    {
        $com_id=$roww['com_id'];
        $sumador_total=0;
        $sql1=mysqli_query($con,"SELECT * FROM  combos_articulos where combos_com_id='$com_id'");
        while($row1=mysqli_fetch_array($sql1))
        {
            $coma_art_id=$row1['coma_art_id'];
            $coma_art_cantidad=$row1['coma_art_cantidad'];
            $coma_art_precio=$row1['coma_art_precio'];
            $art_pvp=$coma_art_cantidad*$coma_art_precio;
            $sumador_total+=$art_pvp;//Sumador
        }

        $pdf->SetWidths(array(30,120,30));
        srand(time()*1000000);
        $pdf->Row(array($roww['com_referencia'],$roww['com_nombre'],number_format($sumador_total,0)));
    }
$pdf->Output();
?>
