loadLangs(array('bills', 'companies')); $id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); $lineid = GETPOST('lineid', 'int'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); $timestamp = GETPOST('timestamp', 'alpha'); $Bbticketcounter = new Bbticketcounter(); //print_r($_REQUEST); // Kikeresem a facture_id-hoz tartozó jegyeket a llx_bbus_bbticketinvoiceprinting táblából. Osszekotni: user, jegy adatok (bbticket), hol hasznaltak $res = getBbticketinvoiceprinting($id); // Security check if ($user->socid) { $socid = $user->socid; } $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } $result = restrictedArea($user, 'facture', $object->id); /* * View */ $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('ContactsAddresses'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); $form = new Form($db); $formcompany = new FormCompany($db); $contactstatic = new Contact($db); $userstatic = new User($db); $PDF_Crabe = new pdf_crabe_new_printinginvoice($db); $PDF_Crabe_receipt = new pdf_crabe_receipt($db); function getBbticketinvoiceprinting($id) { global $db; $bbticketinvoiceprinting = new BbTicketInvoicePrinting($db); $sql = "SELECT product.label, ticket.available_at, ticket.validated_at, ticket.expire_at, ticket.usable_occasions, ticket.usage, tip.date_creation, tip.ticket_id, ticket.bundle_id, ticket.ticket_id as product_id, tip.printing_date, usr.lastname, usr.firstname FROM " . $db->prefix() . $bbticketinvoiceprinting->table_element . " AS tip INNER JOIN llx_user as usr ON tip.fk_user_creat = usr.rowid INNER JOIN llx_bbus_bbticket as ticket ON tip.ticket_id = ticket.rowid INNER JOIN llx_product AS product ON ticket.ticket_id = product.rowid WHERE tip.fk_facture = {$id}"; //print $sql; return $db->query($sql); } function getTicketnaploByTicketId($id) { global $db; $bbticketNaplo = new BbTicketNaplo($db); $sql = "SELECT loc.location_name, loc.available_services, naplo.date_creation AS naplo_date_creation, naplo.status, devices.device_name, devices.device_function, devices.device_type, devices.ref FROM " . $db->prefix() . $bbticketNaplo->table_element . " as naplo LEFT JOIN llx_bbus_bbdevices AS devices ON naplo.device_id = devices.rowid AND naplo.device_id IS NOT NULL LEFT JOIN llx_bbus_bbdevicesservicelocation as ds ON ds.rowid = naplo.bbservicelocation_id LEFT JOIN llx_bbus_bbservicelocation AS loc ON ds.service_location_id = loc.rowid AND naplo.bbservicelocation_id IS NOT NULL WHERE ticket_row_id = {$id} ORDER BY naplo_date_creation DESC"; return $db->query($sql); } function getQRcode($facture_id, $ticket_id) { global $db; $sql = "SELECT bbti.printing_date_timestamp AS timestamp FROM llx_bbus_bbticketinvoiceprinting AS bbti INNER JOIN llx_facture as f ON f.rowid = bbti.fk_facture WHERE bbti.fk_facture = {$facture_id} AND bbti.ticket_id = {$ticket_id}"; $result = $db->query($sql); if (pg_num_rows($result) > 0) { $data = pg_fetch_assoc($result); return $data['timestamp']; } return ''; } function createPDFButton($id, $ticket_id) { global $langs; $string = ''; $QRCode = getQRcode($id, $ticket_id); if ($QRCode != '') { $string = '' . $langs->trans('GenerateInvoice') . ''; } return $string; } if ($timestamp !== '') { if ($object->type == 7) { $result = $PDF_Crabe_receipt->write_file($object, $timestamp, $langs); } else { $result = $PDF_Crabe->write_file($object, $timestamp, $langs); } if ($result == 1) { setEventMessage($langs->trans('InvoiceReady')); } else { setEventMessage($langs->trans('InvoiceFailed'), 'error'); } } function setColor($status) { return $status == 0 ? 'green' : 'red'; } /* *************************************************************************** */ /* */ /* View and edit mode */ /* */ /* *************************************************************************** */ if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { $object->fetch_thirdparty(); $head = facture_prepare_head($object); $totalpaid = $object->getSommePaiement(); print dol_get_fiche_head($head, 'tickets', $langs->trans('InvoiceCustomer'), -1, 'bill'); print ''; // Invoice content $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref = '
| ' . $langs->trans('TicketId') . ' | '; $content .= '' . $langs->trans('TicketLabel') . ' | '; $content .= '' . $langs->trans('PrintingDate') . ' | '; $content .= '' . $langs->trans('PrintingUser') . ' | '; $content .= '' . $langs->trans('validated_at') . ' | '; $content .= '' . $langs->trans('expire_at') . ' | '; $content .= '' . $langs->trans('available_at') . ' | '; $content .= ''; $content .= ' | |
|---|---|---|---|---|---|---|---|---|
| ' . $row['ticket_id'] . ' | '; $content .= '' . $row['label'] . ' | '; $content .= '' . $row['printing_date'] . ' | '; $content .= '' . $row['lastname'] . ' ' . $row['firstname'] . ' | '; $content .= '' . $row['validated_at'] . ' | '; $content .= '' . $row['expire_at'] . ' | '; $content .= '' . $row['available_at'] . ' | '; $content .= '' . $PDFButton . ' | '; $content .= ''; $content .= ' |