public function PrintEntrades() { $R = $this->getAjaxData(); $CTO = new ComandaTableObject(); $CTO->loadComandaByCodi($R['CodiComanda']); if ($CTO->isPagada()) { echo json_encode(Pdf::generateEntrades($CTO, false)); } else { throw new MyException("L'entrada que vol imprimir no existeix o no s'ha reservat correctament."); } }