* Copyright (C) 2011-2023 Laurent Destailleur * Copyright (C) 2012 Marcos García * Copyright (C) 2018 Andreu Bisquerra * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2021 Nicolas ZABOURI * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/takepos/receipt.php * \ingroup takepos * \brief Page to show a receipt. */ // Include main (when fie in included into send.php, $action is set and main was already loaded) if (!isset($action)) { //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', '1'); } if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', '1'); } if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } require '../main.inc.php'; // If this file is called from send.php avoid load again } include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "bills", "cashdesk", "companies")); $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $facid = GETPOSTINT('facid'); $action = GETPOST('action', 'aZ09'); $gift = GETPOSTINT('gift'); if (!$user->hasRight('takepos', 'run')) { accessforbidden(); } /* * View */ top_httphead('text/html', 1); if ($place > 0) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { $facid = $obj->rowid; } } $object = new Facture($db); $object->fetch($facid); // Call to external receipt modules if exist $parameters = array(); $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object); if (!empty($hookmanager->resPrint)) { print $hookmanager->resPrint; return; // Receipt page can be called by the takepos/send.php page that use ob_start/end so we must use return and not exit to stop page } // IMPORTANT: This file is sended to 'Takepos Printing' application. Keep basic file. No external files as css, js... If you need images use absolute path. ?>
'.$mysoc->name.''; ?>

trans('Date')." ".dol_print_date($object->date, 'day').'
'; if (getDolGlobalString('TAKEPOS_RECEIPT_NAME')) { print getDolGlobalString('TAKEPOS_RECEIPT_NAME') . " "; } if ($object->statut == Facture::STATUS_DRAFT) { print str_replace(")", "", str_replace("-", " ".$langs->trans('Place')." ", str_replace("(PROV-POS", $langs->trans("Terminal")." ", $object->ref))); } else { print $object->ref; } if (getDolGlobalString('TAKEPOS_SHOW_CUSTOMER')) { if ($object->socid != getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"])) { $soc = new Societe($db); if ($object->socid > 0) { $soc->fetch($object->socid); } else { $soc->fetch(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"])); } print "
".$langs->trans("Customer").': '.$soc->name; } } if (getDolGlobalString('TAKEPOS_SHOW_DATE_OF_PRINING')) { print "
".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel').'
'; } ?>


0 ? GETPOSTINT('qty') : 1; print ''; print ''; print ''; print ''; if (getDolGlobalString('TAKEPOS_SHOW_HT_RECEIPT')) { print ''; } print ''; print ''; } else { foreach ($object->lines as $line) { ?>
trans("Label"); ?> trans("Qty"); ?> trans("Price"); } ?> trans("TotalHT"); } ?> trans("TotalTTC"); } ?>
' . GETPOST('label', 'alphanohtml') . '' . $qty . '' . price(price2num($object->total_ttc / $qty, 'MU'), 1) . '' . price($object->total_ht, 1) . '' . price($object->total_ttc, 1) . '
product_label)) { echo $line->product_label; } else { echo $line->description; } ?> qty; ?> total_ttc / $line->qty, 'MT'), 1); } ?> total_ht, 1); } ?> total_ttc, 1); } ?>

lines as $line) { if (!array_key_exists($line->tva_tx, $vat_groups)) { $vat_groups[$line->tva_tx] = 0; } $vat_groups[$line->tva_tx] += $line->total_tva; } // Loop on each VAT group foreach ($vat_groups as $key => $val) { ?> total_localtax1, 'MU') || $mysoc->useLocalTax(1)) { ?> total_localtax2, 'MU') || $mysoc->useLocalTax(2)) { ?> currency != $_SESSION["takeposcustomercurrency"]) { //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $multicurrency = new MultiCurrency($db); $multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]); echo ''; } if (getDolGlobalString('TAKEPOS_PRINT_PAYMENT_METHOD')) { if (empty($facid)) { // Case of specimen echo ''; echo ''; echo ''; echo ''; } else { $sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num,"; $sql .= " f.multicurrency_code,"; $sql .= " pf.amount as amount, pf.multicurrency_amount,"; $sql .= " cp.code"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid); $sql .= " ORDER BY p.datep"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $row = $db->fetch_object($resql); echo ''; echo ''; echo ''; echo ''; if ((!isModEnabled('multicurrency') || $object->multicurrency_tx == 1) && $row->code == "LIQ" && $row->pos_change > 0) { echo ''; echo ''; echo ''; echo ''; } $i++; } } } } ?>
trans("TotalHT"); } ?> total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n"; } ?>
trans("VAT").' '.vatrate($key, 1); } ?> currency)."\n"; } ?>
trans("TotalVAT").''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n"; } ?>
trans("TotalLT1").''.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency)."\n"; } ?>
trans("TotalLT2").''.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency)."\n"; } ?>
trans("TotalTTC").''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n"; } ?>
'; if ($gift != 1) { echo ''.$langs->trans("TotalTTC").' '.$_SESSION["takeposcustomercurrency"].''.price($object->total_ttc * $multicurrency->rate->rate, 1, '', 1, - 1, - 1, $_SESSION["takeposcustomercurrency"])."\n"; } echo '
'; echo $langs->transnoentitiesnoconv("PaymentTypeShortLIQ"); echo ''; $amount_payment = 0; echo price($amount_payment, 1, '', 1, - 1, - 1, $conf->currency); echo '
'; echo $langs->transnoentitiesnoconv("PaymentTypeShort".$row->code); echo ''; $amount_payment = (isModEnabled('multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; //print "xx ".$row->multicurrency_amount." - ".$row->amount." - ".$amount_payment." - ".$object->multicurrency_tx; if ((!isModEnabled('multicurrency') || $object->multicurrency_tx == 1) && $row->code == "LIQ" && $row->pos_change > 0) { $amount_payment += $row->pos_change; // Show amount with excess received if it's cash payment $currency = $conf->currency; } else { // We do not show change if payment into a different currency because not yet supported $currency = $row->multicurrency_code; } echo price($amount_payment, 1, '', 1, - 1, - 1, $currency); echo '
'; echo $langs->trans("Change"); // ChangeBack ? echo ''; echo price($row->pos_change, 1, '', 1, - 1, - 1, $currency); echo '