public function generaMailEntrada($idEntrada, $idS = 1) { $OM = new OptionsModel(); $TEXT = $OM->getOption('BODY_MAIL_ENTRADES', $idS); $EM = new EntradesModel(); $OE = $EM->getEntradaById($idEntrada); $OA = $EM->getActivitatById($OE['idEspectacle']); $TEXT = str_replace('{{NUM_ENTRADES}}', $OE['num_entrades'], $TEXT); $TEXT = str_replace('{{ACTIVITAT}}', $OA['Nom'], $TEXT); $TEXT = str_replace('{{DIA}}', $OA['Dia'], $TEXT); $TEXT = str_replace('{{HORA}}', $OA['Hora'], $TEXT); $TEXT = str_replace('{{NOM_COMPRA}}', $OE['nom_reserva'], $TEXT); \Helpers\MyHelpers\Pdf::generateEntrada($EM->EntradaObject($OE, true)); $URL = self::$URL_ENTRADES . $OE['idEntrada'] . '.pdf'; $this->enviaMail('*****@*****.**', '*****@*****.**', 'Entrada per a un espectacle', $TEXT, $URL); return $this->enviaMail('*****@*****.**', $OE['email_reserva'], 'Entrada per a un espectacle', $TEXT, $URL); }
public static function generateLlistatEntrades($idEspectacle) { $EM = new EntradesModel(); $ESTATS = array('AP' => 'Pagat', 'ANP' => 'No pagat', 'R' => 'Invitació'); $AOL = $EM->getLocalitatsVenudes($idEspectacle); $p = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $p->SetCreator(PDF_CREATOR); $p->SetAuthor('Casa de Cultura de Girona'); $p->SetTitle('CCG'); $p->SetSubject('CCG'); $p->SetKeywords('CCG'); //$p->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $p->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $p->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $p->setImageScale(PDF_IMAGE_SCALE_RATIO); $p->SetFont('dejavusans', '', 10); $p->AddPage(); $html = ' <table style="width:100%"> <tr> <td style="color:white; background-color: #cc3300; width:40%; font-weight:bold;">Nom</td> <td style="color:white; background-color: #cc3300; width:20%; font-weight:bold;">Estat</td> <td style="color:white; background-color: #cc3300; width:20%; font-weight:bold;">Entrades generals</td> <td style="color:white; background-color: #cc3300; width:20%; font-weight:bold;">Comentari</td> </tr>'; foreach ($AOL as $K => $LV) { $entrades = json_decode($LV['entrades'], true); $num_entrades_normal = $entrades[0]['quantitat']; $num_entrades_descompte = $entrades[1]['quantitat']; $html .= ' <tr> <td style="border:1px solid gray; padding:5px;">' . $LV['nom_reserva'] . '</td> <td style="border:1px solid gray; padding:5px;">' . $ESTATS[$LV['estat']] . '</td> <td style="border:1px solid gray; padding:5px;">' . $num_entrades_normal . '</td> <td style="border:1px solid gray; padding:5px;">' . $LV['comentari'] . '</td> </tr>'; } $html .= '</table> '; $p->writeHTML($html); $p->lastPage(); $p->Output('/var/www/hospici_cultural/web/documents/entrades/llistat-' . $idEspectacle . '.pdf', 'F'); }
public function getEntradesPerDiaIMitjaPagament() { $EM = new EntradesModel(); $postdata = file_get_contents("php://input"); $request = json_decode($postdata, true); echo json_encode($EM->getEntradesPerDiaIMitjaPagament($request['TipusPagament'], $request['idEspectacle'])); }