<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace CmBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use CmBundle\Entity\Ingresos;
use CmBundle\Entity\AlumonTramites;
use CmBundle\Controller\PDFMercadotecnia;

date_default_timezone_set('America/Mexico_City');

/**
 * Description of CajaController
 *
 * @author omar
 */
class RecibosController extends Controller {

    //put your code here

    public function reciboPruebaAction(Request $request) {
        $session = $request->getSession();
        if ($session->has("idEmpleado") && ($session->get("rol") == 2 || $session->get("rol") == 3)) {
            $session->set("vista", "caja");
            //if ($request->getMethod() == "POST") {
            
            $pdf = new PDFMercadotecnia('P', 'cm', array(10,15) );
            $pdf->AddPage();
            $pdf->AliasNbPages();
            $pdf->SetFont('Arial', '', 12);
            $pdf->recibo("a", "b");

            return new Response($pdf->Output('recibo.pdf', 'I'), 200, array('Content-Type' => 'application/pdf'));
            //}
        } else {
            return $this->render('CmBundle:Seguridad:login.html.twig');
        }
    }

}
