<?php    
        $sucursales = $data['stores'];
        $data = $data['data'];                   
        
        $pdf = new PDF();
        $pdf->AddPage('L','');
        
        $pdf->SetFont('Arial','B','11');     
        $pdf->Cell(275, 12, $this->headerExcelReport, '0', 1, 'C'); //<== margin left    
        $pdf->Cell(275, 4, 'Generado: '.date('F j, Y, g:i a'), '0', 1, 'C');
        
        $pdf->ln(5);              
        $pdf->SetFont('Arial','B','8');             
        $pdf->SetFillColor(245,245,245); 
        $pdf->Cell(52, 6, "Producto", 'B', 0, 'C');  
        foreach($sucursales as $store_id => $store_name){$pdf->Cell(11, 6, $store_name, 'B', 0, 'C');}        
        $pdf->Cell(14, 6, "Total", 'B', 1, 'C');        
        
        $pdf->SetFont('Arial','','8');                
        $fila = 2;
        $backgroundcolor = null;    
        $pageCout=1;
        foreach($data as $row){ 
			if($pageCout>25)
			{
				$pdf->AddPage('L','');
				$pdf->SetFont('Arial','B','8');    
				$pdf->Cell(50, 6, "Producto", 'B', 0, 'C');  
				foreach($sucursales as $store_id => $store_name){$pdf->Cell(11, 6, $store_name, 'B', 0, 'C');}        
				$pdf->Cell(14, 6, "Total", 'B', 1, 'C');
				$pageCout = 1;
				$pdf->SetFont('Arial','','8');    
			}
            $total = 0;
            if ($fila%2==0){$backgroundcolor = true;}
            else{$backgroundcolor = null;}         
        
            $pdf->Cell(52, 6, utf8_decode($row['description']), '0', 0, 'C',$backgroundcolor);
            foreach($sucursales as $store_id => $store_name){                   
                $total += $row[$store_id];                
                $pdf->Cell(11, 6, $row[$store_id], '0', 0, 'C',$backgroundcolor);                                     
            }  
            $fila++;
			$pageCout++;
            $pdf->Cell(14, 6, $total, '0', 1, 'C',$backgroundcolor);
        }
        
        /*BLOQUEAR PEDIDOS EN EL RANGO DE FECHA SELECCIONADO*/        
        $repoStoreRequest = new StoreRequestRepository();
        $repoStoreRequest->setStatusInProcessByRangeDate($this->getOptions());
        
        if($this->saveFile == true){    
            $pdf->Output($this->getTempFolder()."/".$this->getNombreArchivo().".pdf","F");
        }else{
            $pdf->Output();
        }
        
        
        
       

    

