42 if (!defined(
'NOTOKENRENEWAL')) {
43 define(
'NOTOKENRENEWAL',
'1');
45 if (!defined(
'NOREQUIREMENU')) {
46 define(
'NOREQUIREMENU',
'1');
48 if (!defined(
'NOREQUIREHTML')) {
49 define(
'NOREQUIREHTML',
'1');
51 if (!defined(
'NOREQUIREAJAX')) {
52 define(
'NOREQUIREAJAX',
'1');
55 require
'../main.inc.php';
65include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
66include_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
68$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"companies"));
74$action =
GETPOST(
'action',
'aZ09');
77if (!$user->hasRight(
'takepos',
'run')) {
95if (!$facid && (
string) $place !=
'' && !empty($_SESSION[
"takeposterminal"])) {
96 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
97 $sql .=
" WHERE ref = '(PROV-POS".$db->escape($_SESSION[
"takeposterminal"].
"-".$place).
")'";
98 $sql .=
" AND entity IN (".getEntity(
'invoice').
")";
100 $resql = $db->query($sql);
101 $obj = $db->fetch_object($resql);
103 $facid = $obj->rowid;
107if ($facid > 0 && !
GETPOST(
'specimen')) {
110 $object->initAsSpecimen(
'takepos');
123 console.log('Call /blockedlog/ajax/block-add on output of receipt.php.');
124 $.post('".DOL_URL_ROOT.
"/blockedlog/ajax/block-add.php'
128 , action: 'DOC_PREVIEW'
142 $conf->global->TAKEPOS_SHOW_HT_RECEIPT = 1;
143 $conf->global->TAKEPOS_TICKET_VAT_GROUPPED = 1;
145 $parameters = array();
146 $hookmanager->initHooks(array(
'takeposfrontend'));
147 $reshook = $hookmanager->executeHooks(
'TakeposReceipt', $parameters, $object);
148 if (!empty($hookmanager->resPrint)) {
149 print $hookmanager->resPrint;
170@media only screen and (min-width: 1024px)
179<div style=
"font-size: 1.5em">
181echo
'<b>'.$mysoc->name.
'</b>';
185 print
'!!!!! SPECIMEN !!!!!';
193$constFreeText =
'TAKEPOS_HEADER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
196 $substitutionarray = getCommonSubstitutionArray($langs);
204 print nl2br($newfreetext);
211 $canprintifnotvalidate =
true;
213 $canprintifnotvalidate =
false;
217 if (!$canprintifnotvalidate && empty($facid) && !
GETPOST(
'specimen')) {
218 print
"Error: Printing ticket is not allowed when invoice is not validated/paid.";
230 print $langs->trans(
"InvoiceRef").
" ";
235 if (empty($facid) ||
GETPOST(
'specimen')) {
244print
'<br>'.$langs->trans(
"Terminal").
' '.(
GETPOST(
'specimen') ?
'99' : (
$object->pos_source ?
$object->pos_source :
'Backoffice'));
251 $soc->fetch(
getDolGlobalInt(
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"]));
253 print
"<br>".$langs->trans(
"Customer").
': '.$soc->name;
264 if (
$object->status > $object::STATUS_DRAFT) {
265 $unalterablelogid =
'UNDEFINED';
266 $sql =
"SELECT signature FROM ".MAIN_DB_PREFIX.
"blockedlog";
267 $sql .=
" WHERE action = 'BILL_VALIDATE' AND element = 'facture' AND ref_object = '".$db->escape(
$object->ref).
"'";
268 $sql .= $db->order(
'rowid',
'DESC');
269 $sql .= $db->plimit(1);
271 $resql = $db->query($sql);
273 $obj = $db->fetch_object($resql);
275 $unalterablelogid = $obj->signature;
279 print
"<br>".$langs->trans(
"SignatureID").
': '.
dol_trunc(strtoupper($unalterablelogid), 10);
286$object->pos_print_counter += 1;
289$isADuplicata = (
$object->pos_print_counter >= 2);
291if (
$object->status == $object::STATUS_CLOSED) {
293 print
'<br><b>*** DUPLICATA (no '.($object->pos_print_counter - 1).
') ***</b>';
297 print
'<br><b>*** '.strtoupper($langs->trans(
"TemporaryReceipt")).
' ***</b>';
303<
table class=
"centpercent" style=
"border-top-style: double;">
306 <th
class=
"left"><?php print $langs->trans(
"Label"); ?></th>
307 <th
class=
"right"><?php print $langs->trans(
"Qty"); ?></th>
308 <th
class=
"right"><?php
if ($gift != 1) {
309 print $langs->trans(
"Price");
312 <th
class=
"right"><?php
if ($gift != 1) {
313 print $langs->trans(
"TotalHT");
316 <th
class=
"right"><?php
if ($gift != 1) {
317 print $langs->trans(
"TotalTTC");
323 if ($action ==
'without_details') {
326 print
'<td>' .
GETPOST(
'label',
'alphanohtml') .
'</td>';
327 print
'<td class="right">' . $qty .
'</td>';
330 print
'<td class="right">' .
price(
$object->total_ht, 1) .
'</td>';
332 print
'<td class="right">' .
price(
$object->total_ttc, 1) .
'</td>';
335 foreach (
$object->lines as $line) {
339 <?php
if (!empty($line->product_label)) {
340 echo $line->product_label;
345 <td
class=
"right"><?php echo $line->qty; ?></td>
346 <td
class=
"right"><?php
if ($gift != 1) {
351 <td
class=
"right"><?php
if ($gift != 1) {
352 echo
price($line->total_ht, 1);
356 <td
class=
"right"><?php
if ($gift != 1) {
357 echo
price($line->total_ttc, 1);
367<
table class=
"right centpercent">
369 <th
class=
"right"><?php
if ($gift != 1) {
370 echo $langs->trans(
"TotalHT");
372 <td
class=
"right"><?php
if ($gift != 1) {
373 echo
price(
$object->total_ht, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
378 $vat_groups = array();
379 foreach (
$object->lines as $line) {
380 if (!array_key_exists((
string) $line->tva_tx, $vat_groups)) {
381 $vat_groups[(string) $line->tva_tx] = 0;
383 $vat_groups[(string) $line->tva_tx] += $line->total_tva;
387 foreach ($vat_groups as $key => $val) {
390 <th align=
"right"><?php
if ($gift != 1) {
391 echo $langs->trans(
"VAT").
' '.
vatrate($key,
true);
393 <td align=
"right"><?php
if ($gift != 1) {
394 echo
price($val, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
401 <th
class=
"right"><?php
if ($gift != 1) {
402 echo $langs->trans(
"TotalVAT").
'</th><td class="right">'.
price(
$object->total_tva, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
416 <th
class=
"right"><?php
if ($gift != 1) {
417 echo
''.$langs->trans(
"TotalLT1").
'</th><td class="right">'.
price(
$object->total_localtax1, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
423 <th
class=
"right"><?php
if ($gift != 1) {
424 echo
''.$langs->trans(
"TotalLT2").
'</th><td class="right">'.
price(
$object->total_localtax2, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
429 <th
class=
"right"><?php
if ($gift != 1) {
430 echo
''.$langs->trans(
"TotalTTC").
'</th><td class="right">'.
price(
$object->total_ttc, 1,
'', 1, - 1, - 1, $conf->currency).
"\n";
434if (
isModEnabled(
'multicurrency') && !empty($_SESSION[
"takeposcustomercurrency"]) && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
436 include_once DOL_DOCUMENT_ROOT.
'/multicurrency/class/multicurrency.class.php';
438 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
439 echo
'<tr><th class="right">';
441 echo
''.$langs->trans(
"TotalTTC").
' '.$_SESSION[
"takeposcustomercurrency"].
'</th><td class="right">'.
price(
$object->total_ttc * $multicurrency->rate->rate, 1,
'', 1, - 1, - 1, $_SESSION[
"takeposcustomercurrency"]).
"\n";
448 $conf->global->TAKEPOS_PRINT_PAYMENT_METHOD = 1;
455 echo
'<td class="right">';
456 echo $langs->transnoentitiesnoconv(
"PaymentTypeShortLIQ");
458 echo
'<td class="right">';
460 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $conf->currency);
464 $sql =
"SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num,";
465 $sql .=
" f.multicurrency_code,";
466 $sql .=
" pf.amount as amount, pf.multicurrency_amount,";
468 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiement_facture as pf, ".MAIN_DB_PREFIX.
"facture as f, ".MAIN_DB_PREFIX.
"paiement as p";
469 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
470 $sql .=
" WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $facid);
471 $sql .=
" ORDER BY p.datep";
473 $resql = $db->query($sql);
475 $num = $db->num_rows($resql);
479 $row = $db->fetch_object($resql);
482 echo
'<td class="right">';
483 echo $langs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
485 echo
'<td class="right">';
486 $amount_payment = (
isModEnabled(
'multicurrency') &&
$object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->
amount;
488 if ((!
isModEnabled(
'multicurrency') ||
$object->multicurrency_tx == 1) && $row->code ==
"LIQ" && $row->pos_change > 0) {
489 $amount_payment += $row->pos_change;
490 $currency = $conf->currency;
493 $currency = $row->multicurrency_code;
495 echo
price($amount_payment, 1,
'', 1, - 1, - 1, $currency);
498 if ((!
isModEnabled(
'multicurrency') ||
$object->multicurrency_tx == 1) && $row->code ==
"LIQ" && $row->pos_change > 0) {
500 echo
'<td class="right">';
501 echo $langs->trans(
"Change");
503 echo
'<td class="right">';
504 echo
price($row->pos_change, 1,
'', 1, - 1, - 1, $currency);
520$constFreeText =
'TAKEPOS_FOOTER'.(empty($_SESSION[
'takeposterminal']) ?
'0' : $_SESSION[
'takeposterminal']);
523 $substitutionarray = getCommonSubstitutionArray($langs);
535 $langs->load(
"blockedlog");
536 print
'<center class="small"><i>';
537 print $langs->trans(
"LNECertifiedPOSSystem").
"<br>";
539 $labelidprof = $langs->transcountry(
"ProfId2Short",
$mysoc->country_code);
540 print $labelidprof.
': '.
$mysoc->idprof2;
541 } elseif (
$mysoc->idprof1) {
542 $labelidprof = $langs->transcountry(
"ProfId1Short",
$mysoc->country_code);
543 print $labelidprof.
': '.
$mysoc->idprof1;
545 print
'ERROR: SIREN/SIRET not defined. Ticket not valid !!!';
548 $labelidprof = $langs->trans(
"VATIntra");
549 print
' - '.$labelidprof.
': '.
$mysoc->tva_intra;
551 print
"</i></center><br>\n";
555if (!
GETPOST(
'forcenoautoopen')) {
557 <script
type=
"text/javascript">
560 print
'window.print();';
if(! $sortfield) if(! $sortorder) $object
isALNEQualifiedVersion($ignoredev=0, $ignoremodule=0)
Return if the version is a candidate version to get the LNE certification and if the prerequisites ar...
isALNERunningVersion($blockedlogtestalreadydone=0)
Return if the application is executed with the LNE requirements on.
Class to manage invoices.
const STATUS_DRAFT
Draft status.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_now($mode='gmt')
Return date for now.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
currentToken()
Return the value of token currently saved into session with name 'token'.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
treeview li table
No Email.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.