Exemplo n.º 1
0
 public function execute()
 {
     global $application;
     if (isset($_GET['user'])) {
         $view = parent::getView();
         $application->database->prepare('SELECT id FROM server_users WHERE username = ?', array($_GET['user']));
         $id = $application->database->execute()->result;
         $key = generate_ticket(array($id, $_GET['user']));
         $application->database->prepare('UPDATE server_users SET client_key = ? WHERE id = ?', array($key, $id));
         $application->database->execute();
         $view->set('user->sso', $key);
         $view->set('rand->number', rand(0, 999));
         $view->execute();
     } else {
         if (!isset($_SESSION['master_email'])) {
             $application->direct('index', false);
             exit;
         } else {
             if (!isset($_SESSION['habbo']['id'])) {
                 $application->direct('characters', false);
                 exit;
             }
         }
         $view = parent::getView();
         $key = generate_ticket(array($application->user->id, $application->user->username));
         $application->user->set_sso($key);
         $view->set('user->sso', $key);
         $view->set('rand->number', rand(0, 999));
         $view->execute();
     }
 }
Exemplo n.º 2
0
function generate_facture($productos = array(), $client = array())
{
    $pdf = new PDF_Invoice('P', 'mm', 'A4');
    $pdf->AddPage();
    $pdf->addSociete("TheCatLong", "Av. España N°76, Illes Balears.\n" . "07800 Eivissa, Illes Balea\n" . "Capital: 18000 " . EURO);
    $pdf->fact_dev("Devis ", "TEMPO");
    $pdf->temporaire("Factura");
    $pdf->addDate("03/12/2003");
    $pdf->addClient("CL01");
    $pdf->addPageNumber("1");
    $pdf->addClientAdresse("Ste\nM. XXXX\n3ème étage\n33, rue d'ailleurs\n75000 PARIS");
    $pdf->addReglement("Pago online");
    $pdf->addEcheance("03/12/2003");
    $pdf->addNumTVA("FR888777666");
    $pdf->addReference("Devis ... du ....");
    $cols = array("REFERENCIA" => 23, "DESCRIPCION" => 78, "CANTIDAD" => 22, "PRECIO UNI." => 26, "PRECIO TOTAL" => 30, "I.V.A." => 11);
    $pdf->addCols($cols);
    $cols = array("REFERENCIA" => "L", "DESCRIPCION" => "L", "CANTIDAD" => "C", "PRECIO UNI." => "R", "PRECIO TOTAL" => "R", "I.V.A." => "C");
    $pdf->addLineFormat($cols);
    $pdf->addLineFormat($cols);
    $y = 109;
    $total = 0;
    foreach ($productos as $id => $pro) {
        $totalProducto = $pro["precio"] + $pro["precio"] * 0.21;
        $total += $totalProducto;
        $line = array("REFERENCIA" => "REF" . $pro['idproducto'], "DESCRIPCION" => ucfirst($pro['descripcion']), "CANTIDAD" => "1", "PRECIO UNI." => $pro["precio"] . " " . EURO, "PRECIO TOTAL" => $totalProducto, "I.V.A." => "21%");
        $size = $pdf->addLine($y, $line);
        $y += $size + 2;
    }
    $pdf->addCadreTVAs();
    $tot_prods = array(array("px_unit" => $totalProducto, "qte" => 1, "tva" => 1), array("px_unit" => 0, "qte" => 1, "tva" => 1));
    $tab_tva = array("1" => 21, "2" => 5.5);
    $params = array("RemiseGlobale" => 1, "remise_tva" => 1, "remise" => 0, "remise_percent" => 0, "FraisPort" => 1, "portTTC" => 0, "portHT" => 0, "portTVA" => 21, "AccompteExige" => 1, "accompte" => 0, "accompte_percent" => 0, "Remarque" => "");
    $pdf->addTVAs($params, $tab_tva, $tot_prods);
    $pdf->addCadreEurosFrancs();
    $tmpFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid(time()) . 'factura.pdf';
    $pdf->Output($tmpFile, 'F');
    return sendEmail(true, array($client), 'Factura', 'Ya tiene disponible su factura. Grácias por su compra', array(array('absolute' => true, 'path' => $tmpFile), array('absolute' => true, 'path' => generate_ticket($productos, true))));
}
Exemplo n.º 3
0
 public function ticketAction()
 {
     // Ajax ticket
     header('Access-Control-Allow-Origin: *');
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         if (isset($_POST['productos']) && !empty($_POST['productos'])) {
             if (empty($_POST['pdf'])) {
                 $_SESSION['productos'] = array();
             }
             foreach ($_POST['productos'] as $pro) {
                 $_SESSION['productos'][$pro['idproducto']] = array($pro['q'], $pro['size'], $pro['color']);
             }
             echo "OK";
             return;
         }
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             if (empty($_POST['pdf'])) {
                 $_SESSION['productos'] = array();
             }
         }
     }
     if (!self::getSession('username')) {
         flash('msg', 'Debe loguearse para acceder.', 'Warning!', 'warning');
         return header('location: /');
     }
     if (isset($_SESSION['productos']) && !empty($_SESSION['productos'])) {
         $productos = $this->_generate_products();
         return generate_ticket($productos);
     }
     flash('msg', 'No hay productos en la cesta', 'Warning!', 'warning');
     return header('location: /');
 }
Exemplo n.º 4
0
$pdf->Write(5, "Present this ticket at the registration table to receive your \$15 Alamo food gift card.\n");
$pdf->Ln();
#$pdf->SetX(25);
$pdf->SetFont('', 'B');
$pdf->Write(5, 'Where: ');
PutLink($pdf, 'One Loudoun, 20575 Easthampton Plaza, Ashburn, VA 20147', 'https://www.google.com/maps/place/Alamo+Drafthouse+Cinema/@39.0477854,-77.4656295,14z/data=!4m2!3m1!1s0x0:0x3fda98f8c48cb5aa');
$pdf->Ln();
$pdf->SetFont('', 'B');
$pdf->Write(5, 'When: ');
$pdf->SetFont('', '');
$pdf->Write(5, "Saturday, March 5th @ 11:00\n\n");
$pdf->SetFont('', '', 10);
$pdf->Write(5, "Please arrive 15 minutes before the showtime to\nselect a seat and take a look at the menu.  You\nmight not be seated if you arrive after the showtime.\nAlamo has a strict no talking/texting policy. Noisy\ntables get one warning before being ejected from\nthe theatre.\n\nFursuits have been approved inside the Alamo,\nhowever was not approved by the property owners.\nAs such we ask that fursuits be worn indoors only,\nbut note that there is no dedicated changing\nareas.\n");
$pdf->Image('images/map.png', 110, 50, 80, 0, '', 'https://www.google.com/maps/place/Alamo+Drafthouse+Cinema/@39.0477854,-77.4656295,14z/data=!4m2!3m1!1s0x0:0x3fda98f8c48cb5aa');
$ticket = generate_ticket($_GET['name'], $_GET['code'], 1, $_GET['seats'], '');
$pdf->GDImage($ticket, 35, 120, 140);
$pdf->Line(25, 120, 190, 120);
$ticket = generate_ticket($_GET['name'], $_GET['code'], 2, $_GET['seats'], '');
$pdf->GDImage($ticket, 35, 190, 140);
$pdf->Line(30, 190, 180, 190);
$pdf->AddPage();
$ticket = generate_ticket($_GET['name'], $_GET['code'], 2, $_GET['seats'], '');
$pdf->GDImage($ticket, 35, 30, 140);
$pdf->Line(30, 100, 180, 100);
$ticket = generate_ticket($_GET['name'], $_GET['code'], 2, $_GET['seats'], '');
$pdf->GDImage($ticket, 35, 100, 140);
$pdf->Line(30, 170, 180, 170);
$ticket = generate_ticket($_GET['name'], $_GET['code'], 2, $_GET['seats'], '');
$pdf->GDImage($ticket, 35, 170, 140);
imagedestroy($ticket);
$pdf->Output('', "Zootopia-tickets.pdf");